Posts: 2
Threads: 1
Joined: Nov 2023
Hello,
I use curvy splines to create a track. The track is not a loop. How do I calculate the travelled distance and the distance left to travel?
Thank you!
Posts: 2,091
Threads: 88
Joined: Jun 2017
11-13-2023, 08:45 PM
(This post was last modified: 11-13-2023, 08:45 PM by _Aka_.)
Hi
Use CurvySpline.GetNearestTF to get the TF of the nearest point on the spline. (see the documentation to learn more about its parameters).
Then use CurvySpline.TFToDistance to convert that TF to a distance. Let's call it D.
The traveled distance on the spline is equal to D.
The distance left to travel on the spline is equal to : CurvySpline.Length - D.
Here is a link to the API reference of the CurvySpline class: https://api.curvyeditor.com/FluffyUnderware.Curvy.CurvySpline.html
I hope this helped.
Have a nice day.
Please consider leaving a
review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Posts: 2
Threads: 1
Joined: Nov 2023
Thank you, I followed your suggestion and got it working.
(11-13-2023, 08:45 PM)_Aka_ Wrote: Hi
Use CurvySpline.GetNearestTF to get the TF of the nearest point on the spline. (see the documentation to learn more about its parameters).
Then use CurvySpline.TFToDistance to convert that TF to a distance. Let's call it D.
The traveled distance on the spline is equal to D.
The distance left to travel on the spline is equal to : CurvySpline.Length - D.
Here is a link to the API reference of the CurvySpline class: https://api.curvyeditor.com/FluffyUnderware.Curvy.CurvySpline.html
I hope this helped.
Have a nice day.
Posts: 2,091
Threads: 88
Joined: Jun 2017
You are welcome.
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a
review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.