Ejemplo n.º 1
0
 /// <summary>
 ///   <para>Returns a copy of vector with its magnitude clamped to maxLength.</para>
 /// </summary>
 /// <param name="vector"></param>
 /// <param name="maxLength"></param>
 public static FixedVector2 ClampMagnitude(FixedVector2 vector, Fixed maxLength)
 {
     if (vector.sqrMagnitude > maxLength * maxLength)
     {
         return(vector.normalized * maxLength);
     }
     return(vector);
 }
Ejemplo n.º 2
0
 public bool Equals(FixedVector2 other)
 {
     return(x == other.x && y == other.y);
 }
Ejemplo n.º 3
0
 /// <summary>
 ///   <para>Linearly interpolates between vectors a and b by t.</para>
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <param name="t"></param>
 public static FixedVector2 Lerp(FixedVector2 a, FixedVector2 b, Fixed t)
 {
     t = FixedMathf.Clamp01(t);
     return(new FixedVector2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t));
 }
Ejemplo n.º 4
0
 public static Fixed Dot(FixedVector2 lhs, FixedVector2 rhs)
 {
     return(lhs.x * rhs.x + lhs.y * rhs.y);
 }