Magnitude#
Math / Geometry / Magnitude Vector2
Can Read
Cannot Write
Description#
Returns the magnitude of a Vector2
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Magnitude")]
[Category("Math/Geometry/Magnitude", "Vector2")]
[Description("Returns the magnitude of a Vector2")]
[Image(typeof(IconAbsolute), ColorTheme.Type.Yellow)]
[Keywords("Vector", "2", "Vector2")]
[Serializable]
public class TypeNumberMathVector2Magnitude : TypeNumber
{
[SerializeField] private GetVector2 m_Vector = new GetVector2();
public override double GetPreview(GameObject source) => this.m_Vector.GetPreview(source).magnitude;
public override double Get(Args args)
{
return this.m_Vector.Get(args).magnitude;
}
public override string ToString()
{
return $"{this.m_Vector} Magnitude";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}