Files
BeatSaber/Assets/VRBeatsKit/Modules/VRSDK/Extension/MathfExtension.cs
T

27 lines
564 B
C#
Raw Normal View History

using UnityEngine;
namespace VRSDK
{
public static class MathfExtension
{
public static Vector3 ClampVectorMagnitude(Vector3 value , float min , float max)
{
Vector3 clampVector = value;
float m = clampVector.magnitude;
if (m > max)
{
clampVector = clampVector.normalized * max;
}
else if (m < min)
{
clampVector = clampVector.normalized * min;
}
return clampVector;
}
}
}