Exemplo n.º 1
0
 public static Vector3 Interp(Spline.Path pts, float t, EasingType ease, bool easeIn, bool easeOut)
 {
     t = Spline.Ease(t, ease, easeIn, easeOut);
     if (pts.Length == 0)
     {
         return Vector3.zero;
     }
     if (pts.Length == 1)
     {
         return pts[0];
     }
     if (pts.Length == 2)
     {
         return Vector3.Lerp(pts[0], pts[1], t);
     }
     if (pts.Length == 3)
     {
         return QuadBez.Interp(pts[0], pts[2], pts[1], t);
     }
     if (pts.Length == 4)
     {
         return CubicBez.Interp(pts[0], pts[3], pts[1], pts[2], t);
     }
     return CRSpline.Interp(Spline.Wrap(pts), t);
 }
Exemplo n.º 2
0
 public static Vector3 InterpConstantSpeed(Spline.Path pts, float t)
 {
     return Spline.InterpConstantSpeed(pts, t, EasingType.Linear);
 }
Exemplo n.º 3
0
 public static Vector3 Interp(Spline.Path pts, float t, EasingType ease)
 {
     return Spline.Interp(pts, t, ease, true);
 }
Exemplo n.º 4
0
 public static Vector3 Velocity(Spline.Path pts, float t)
 {
     return Spline.Velocity(pts, t, EasingType.Linear);
 }
Exemplo n.º 5
0
 public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2, EasingType ease, bool easeIn)
 {
     return Spline.RotationBetween(pts, t1, t2, ease, easeIn, true);
 }
Exemplo n.º 6
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition, ref Quaternion rotation, float maxSpeed, float smoothnessFactor, EasingType ease, bool easeIn, bool easeOut)
 {
     Vector3 vector = Spline.MoveOnPath(pts, currentPosition, ref pathPosition, maxSpeed, smoothnessFactor, ease, easeIn, easeOut);
     rotation = ((!vector.Equals(currentPosition)) ? Quaternion.LookRotation(vector - currentPosition) : Quaternion.identity);
     return vector;
 }
Exemplo n.º 7
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition, ref Quaternion rotation, float maxSpeed)
 {
     return Spline.MoveOnPath(pts, currentPosition, ref pathPosition, ref rotation, maxSpeed, 100f);
 }
Exemplo n.º 8
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition, float maxSpeed, float smoothnessFactor)
 {
     return Spline.MoveOnPath(pts, currentPosition, ref pathPosition, maxSpeed, smoothnessFactor, EasingType.Linear);
 }
Exemplo n.º 9
0
 public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2)
 {
     return(Spline.RotationBetween(pts, t1, t2, EasingType.Linear));
 }
Exemplo n.º 10
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition, ref Quaternion rotation, float maxSpeed, float smoothnessFactor, EasingType ease, bool easeIn)
 {
     return(Spline.MoveOnPath(pts, currentPosition, ref pathPosition, ref rotation, maxSpeed, smoothnessFactor, ease, easeIn, true));
 }
Exemplo n.º 11
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition, ref Quaternion rotation, float maxSpeed)
 {
     return(Spline.MoveOnPath(pts, currentPosition, ref pathPosition, ref rotation, maxSpeed, 100f));
 }
Exemplo n.º 12
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition, float maxSpeed, float smoothnessFactor)
 {
     return(Spline.MoveOnPath(pts, currentPosition, ref pathPosition, maxSpeed, smoothnessFactor, EasingType.Linear));
 }
Exemplo n.º 13
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition)
 {
     return(Spline.MoveOnPath(pts, currentPosition, ref pathPosition, 1f));
 }
Exemplo n.º 14
0
 public static Vector3 InterpConstantSpeed(Spline.Path pts, float t, EasingType ease)
 {
     return(Spline.InterpConstantSpeed(pts, t, ease, true));
 }
Exemplo n.º 15
0
 private static float Ease(float t, EasingType ease, bool easeIn)
 {
     return(Spline.Ease(t, ease, easeIn, true));
 }
Exemplo n.º 16
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition)
 {
     return Spline.MoveOnPath(pts, currentPosition, ref pathPosition, 1f);
 }
Exemplo n.º 17
0
 public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2, EasingType ease, bool easeIn)
 {
     return(Spline.RotationBetween(pts, t1, t2, ease, easeIn, true));
 }
Exemplo n.º 18
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition, float maxSpeed, float smoothnessFactor, EasingType ease, bool easeIn, bool easeOut)
 {
     maxSpeed *= Time.deltaTime;
     pathPosition = Spline.Clamp(pathPosition);
     Vector3 vector = Spline.InterpConstantSpeed(pts, pathPosition, ease, easeIn, easeOut);
     float magnitude;
     while ((magnitude = (vector - currentPosition).magnitude) <= maxSpeed && pathPosition != 1f)
     {
         pathPosition = Spline.Clamp(pathPosition + 1f / smoothnessFactor);
         vector = Spline.InterpConstantSpeed(pts, pathPosition, ease, easeIn, easeOut);
     }
     if (magnitude != 0f)
     {
         currentPosition = Vector3.MoveTowards(currentPosition, vector, maxSpeed);
     }
     return currentPosition;
 }
Exemplo n.º 19
0
 public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2, EasingType ease, bool easeIn, bool easeOut)
 {
     return(Quaternion.LookRotation(Spline.Interp(pts, t2, ease, easeIn, easeOut) - Spline.Interp(pts, t1, ease, easeIn, easeOut)));
 }
Exemplo n.º 20
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition, ref Quaternion rotation, float maxSpeed, float smoothnessFactor, EasingType ease, bool easeIn)
 {
     return Spline.MoveOnPath(pts, currentPosition, ref pathPosition, ref rotation, maxSpeed, smoothnessFactor, ease, easeIn, true);
 }
Exemplo n.º 21
0
 public static Vector3 Velocity(Spline.Path pts, float t)
 {
     return(Spline.Velocity(pts, t, EasingType.Linear));
 }
Exemplo n.º 22
0
 public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2)
 {
     return Spline.RotationBetween(pts, t1, t2, EasingType.Linear);
 }
Exemplo n.º 23
0
 public static Vector3 Velocity(Spline.Path pts, float t, EasingType ease, bool easeIn)
 {
     return(Spline.Velocity(pts, t, ease, easeIn, true));
 }
Exemplo n.º 24
0
 public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2, EasingType ease, bool easeIn, bool easeOut)
 {
     return Quaternion.LookRotation(Spline.Interp(pts, t2, ease, easeIn, easeOut) - Spline.Interp(pts, t1, ease, easeIn, easeOut));
 }
Exemplo n.º 25
0
 public static void GizmoDraw(Vector3[] pts, float t)
 {
     Spline.GizmoDraw(pts, t, EasingType.Linear);
 }
Exemplo n.º 26
0
 public static Vector3 Velocity(Spline.Path pts, float t, EasingType ease, bool easeIn)
 {
     return Spline.Velocity(pts, t, ease, easeIn, true);
 }
Exemplo n.º 27
0
 public static void GizmoDraw(Vector3[] pts, float t, EasingType ease, bool easeIn)
 {
     Spline.GizmoDraw(pts, t, ease, easeIn, true);
 }
Exemplo n.º 28
0
 public static Vector3 Interp(Spline.Path pts, float t)
 {
     return(Spline.Interp(pts, t, EasingType.Linear));
 }
Exemplo n.º 29
0
 public static Vector3 Interp(Spline.Path pts, float t, EasingType ease, bool easeIn)
 {
     return(Spline.Interp(pts, t, ease, easeIn, true));
 }
Exemplo n.º 30
0
 public static Vector3 InterpConstantSpeed(Spline.Path pts, float t, EasingType ease, bool easeIn)
 {
     return Spline.InterpConstantSpeed(pts, t, ease, easeIn, true);
 }
Exemplo n.º 31
0
 private static float Ease(float t)
 {
     return(Spline.Ease(t, EasingType.Linear));
 }