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); }
public static Vector3 InterpConstantSpeed(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.InterpConstantSpeed(Spline.Wrap(pts), t)); }
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); }
public static Vector3 InterpConstantSpeed(Spline.Path pts, float t, EasingType ease, bool easeIn) { return(Spline.InterpConstantSpeed(pts, t, ease, easeIn, true)); }
public static Vector3 InterpConstantSpeed(Spline.Path pts, float t) { return(Spline.InterpConstantSpeed(pts, t, EasingType.Linear)); }
public static Vector3 Velocity(Spline.Path pts, float t, EasingType ease, bool easeIn) { return(Spline.Velocity(pts, t, ease, easeIn, true)); }
public static Vector3 Velocity(Spline.Path pts, float t) { return(Spline.Velocity(pts, t, EasingType.Linear)); }
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))); }
public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2, EasingType ease, bool easeIn) { return(Spline.RotationBetween(pts, t1, t2, ease, easeIn, true)); }
public static Quaternion RotationBetween(Spline.Path pts, float t1, float t2) { return(Spline.RotationBetween(pts, t1, t2, EasingType.Linear)); }
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)); }
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)); }
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)); }
public static Vector3 Interp(Spline.Path pts, float t, EasingType ease) { return(Spline.Interp(pts, t, ease, true)); }
public static Vector3 MoveOnPath(Spline.Path pts, Vector3 currentPosition, ref float pathPosition) { return(Spline.MoveOnPath(pts, currentPosition, ref pathPosition, 1f)); }