Thanks for all your help You are the best!
I don't understand this method very well, but I created simple custom controller:
And I assume MoveByLengthFast(ref float tf, ref int direction, float distance, CurvyClamping clamping) distance is speed, but how can I track my controller reached target distance?
Sorry for my stupid questions.
I don't understand this method very well, but I created simple custom controller:
Code:
public class EnemyWagonController : SplineController
{
private float _tfValue;
private int _direction = 1;
void Awake()
{
Vector3 nearestPoint;
_tfValue = Spline.GetNearestPointTF (transform.localPosition, out nearestPoint);
transform.localPosition = nearestPoint;
}
public override void Refresh ()
{
Move ();
}
void Move()
{
Vector3 nearestPoint;
_tfValue = Spline.GetNearestPointTF (transform.localPosition, out nearestPoint);
transform.localPosition = Spline.MoveByLengthFast (ref _tfValue, ref _direction, 2f, CurvyClamping.PingPong);
}
}
And I assume MoveByLengthFast(ref float tf, ref int direction, float distance, CurvyClamping clamping) distance is speed, but how can I track my controller reached target distance?
Sorry for my stupid questions.