Exemple #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);
 }
Exemple #2
0
 public static Vector3 InterpConstantSpeed(Spline.Path pts, float t)
 {
     return Spline.InterpConstantSpeed(pts, t, EasingType.Linear);
 }
Exemple #3
0
 public static Vector3 Interp(Spline.Path pts, float t, EasingType ease)
 {
     return Spline.Interp(pts, t, ease, true);
 }
Exemple #4
0
 public static Vector3 Velocity(Spline.Path pts, float t)
 {
     return Spline.Velocity(pts, t, EasingType.Linear);
 }
Exemple #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);
 }
Exemple #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;
 }
Exemple #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);
 }
Exemple #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);
 }
Exemple #9
0
 public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2)
 {
     return(Spline.RotationBetween(pts, t1, t2, EasingType.Linear));
 }
Exemple #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));
 }
Exemple #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));
 }
Exemple #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));
 }
Exemple #13
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition)
 {
     return(Spline.MoveOnPath(pts, currentPosition, ref pathPosition, 1f));
 }
Exemple #14
0
 public static Vector3 InterpConstantSpeed(Spline.Path pts, float t, EasingType ease)
 {
     return(Spline.InterpConstantSpeed(pts, t, ease, true));
 }
Exemple #15
0
 private static float Ease(float t, EasingType ease, bool easeIn)
 {
     return(Spline.Ease(t, ease, easeIn, true));
 }
Exemple #16
0
 public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition)
 {
     return Spline.MoveOnPath(pts, currentPosition, ref pathPosition, 1f);
 }
Exemple #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));
 }
Exemple #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;
 }
Exemple #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)));
 }
Exemple #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);
 }
Exemple #21
0
 public static Vector3 Velocity(Spline.Path pts, float t)
 {
     return(Spline.Velocity(pts, t, EasingType.Linear));
 }
Exemple #22
0
 public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2)
 {
     return Spline.RotationBetween(pts, t1, t2, EasingType.Linear);
 }
Exemple #23
0
 public static Vector3 Velocity(Spline.Path pts, float t, EasingType ease, bool easeIn)
 {
     return(Spline.Velocity(pts, t, ease, easeIn, true));
 }
Exemple #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));
 }
Exemple #25
0
 public static void GizmoDraw(Vector3[] pts, float t)
 {
     Spline.GizmoDraw(pts, t, EasingType.Linear);
 }
Exemple #26
0
 public static Vector3 Velocity(Spline.Path pts, float t, EasingType ease, bool easeIn)
 {
     return Spline.Velocity(pts, t, ease, easeIn, true);
 }
Exemple #27
0
 public static void GizmoDraw(Vector3[] pts, float t, EasingType ease, bool easeIn)
 {
     Spline.GizmoDraw(pts, t, ease, easeIn, true);
 }
Exemple #28
0
 public static Vector3 Interp(Spline.Path pts, float t)
 {
     return(Spline.Interp(pts, t, EasingType.Linear));
 }
Exemple #29
0
 public static Vector3 Interp(Spline.Path pts, float t, EasingType ease, bool easeIn)
 {
     return(Spline.Interp(pts, t, ease, easeIn, true));
 }
Exemple #30
0
 public static Vector3 InterpConstantSpeed(Spline.Path pts, float t, EasingType ease, bool easeIn)
 {
     return Spline.InterpConstantSpeed(pts, t, ease, easeIn, true);
 }
Exemple #31
0
 private static float Ease(float t)
 {
     return(Spline.Ease(t, EasingType.Linear));
 }