Signed Angle#
Math / Geometry / Signed Angle Vector3
Can Read
Cannot Write
Description#
Returns the signed angle in degrees between two vectors rotating around an axis
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Signed Angle")]
[Category("Math/Geometry/Signed Angle", "Vector3")]
[Description("Returns the signed angle in degrees between two vectors rotating around an axis")]
[Image(typeof(IconAngleAcute), ColorTheme.Type.Yellow, typeof(BadgeDot))]
[Keywords("Vector", "Alpha")]
[Serializable]
public class TypeNumberMathVector3SignedAngle : TypeNumber
{
[SerializeField] private GetVector3 m_From = new GetVector3();
[SerializeField] private GetVector3 m_To = new GetVector3();
[SerializeField] private GetVector3 m_Axis = new GetVector3(new TypeVector3ConstantUp());
public override double GetPreview(GameObject source) =>
Vector3.SignedAngle(
this.m_From.GetPreview(source),
this.m_To.GetPreview(source),
this.m_Axis.GetPreview(source)
);
public override double Get(Args args)
{
return Vector3.SignedAngle(
this.m_From.Get(args),
this.m_To.Get(args),
this.m_Axis.Get(args)
);
}
public override string ToString()
{
return $"Signed Angle ({this.m_From}, {this.m_To})";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}