02-02-2022, 04:33 PM
Hi
Assuming object A is following object B, here is a bit of code (from the top of my head, might not compile) that would keep A 50m behind B:
float bTF = yourSpline.GetNearestTF(B.transform.position, Space.World);
float bDistance = yourSpline.TfToDistance(bTF);
A.transform.position = yourSpline.InterpolateByDistance(bDistance - 50);
You can keep track of bTF or bDistance from the previous frame to distinguish if B is moving forward or backward.
Otherwise, when it comes to ready made components, Spline Controller is the one you will probably need the most.
Did this help?
Have a nice day
Assuming object A is following object B, here is a bit of code (from the top of my head, might not compile) that would keep A 50m behind B:
float bTF = yourSpline.GetNearestTF(B.transform.position, Space.World);
float bDistance = yourSpline.TfToDistance(bTF);
A.transform.position = yourSpline.InterpolateByDistance(bDistance - 50);
You can keep track of bTF or bDistance from the previous frame to distinguish if B is moving forward or backward.
Otherwise, when it comes to ready made components, Spline Controller is the one you will probably need the most.
Did this help?
Have a nice day
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Please consider leaving a review for Curvy, this helps immensely. Thank you.

