Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get travelled distance and distance to travel
#1
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!
Reply
#2
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.
Reply
#3
Thank you, I followed your suggestion and got it working.  Big Grin


(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.
Reply
#4
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Absolute distance along spline for Shape Extrusion Module amutp 3 264 10-31-2021, 10:26 AM
Last Post: _Aka_
  Volume Spots and Distance from generator topquarkone 5 605 09-16-2021, 08:17 PM
Last Post: _Aka_
  get a point on the curve a distance away from another fortune53 1 699 03-31-2021, 07:46 AM
Last Post: _Aka_
  Max distance between points HTRCH 1 1,075 07-11-2020, 01:07 PM
Last Post: _Aka_

Forum Jump: