Radians to Degrees#
Math / Trigonometry / Radians to Degrees
Can Read
Cannot Write
Description#
Converts a value from radians to degrees
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Radians to Degrees")]
[Category("Math/Trigonometry/Convert Radians to Degrees")]
[Description("Converts a value from radians to degrees")]
[Image(typeof(IconProtractor), ColorTheme.Type.Yellow, typeof(BadgeArrowLeft))]
[Keywords("Convert")]
[Serializable]
public class TypeNumberMathRad2Deg : TypeNumber
{
private const double Rad2Deg = Mathf.Rad2Deg;
[SerializeField] private GetNumber m_Radians = new GetNumber();
public override double GetPreview(GameObject source) => this.m_Radians.GetPreview(source) * Rad2Deg;
public override double Get(Args args)
{
return this.m_Radians.Get(args) * Rad2Deg;
}
public override string ToString()
{
return $"{this.m_Radians} in Degrees";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}