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