Posts: 2
Threads: 1
Joined: Apr 2024
Given a Vector3 in world space, I want get the nearest distance along a spline.
Currently I can use GetNearestPointTF to go from Vector3 to TF and I can convert the TF to a distance. The problem is that the TF value is not consistently spaced along the curve. It appears that distance is consistent so I would like to use that value instead.
I need something like spline.GetNearestPointDistance()
Surely others have had this issue. Is this possible?
Posts: 1,995
Threads: 82
Joined: Jun 2017
Hi
Does this answer your question?
spline.TfToDistance(spline.GetNearestPointTF(...))
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: Apr 2024
Hmmm....that works perfectly. I'm a bit confused why it works. Previously I was using GetNearestPointTF and using that as my From value in a Curvy Generator. The spacing was not consistent, essentially making the From value slightly wrong. I would expect converting a slightly wrong TF value to a distance would result in a slightly wrong distance. Can you explain why this works?
Posts: 1,995
Threads: 82
Joined: Jun 2017
04-16-2024, 07:30 PM
(This post was last modified: 04-16-2024, 07:30 PM by _Aka_.)
TF is not a value that progresses linearly along a spline. Distance on the other hand does. Modules in the Curvy Generator use values that progress linearly. More details in this video:
https://www.youtube.com/watch?v=rP0zuAEoVJw
I hope this helped.
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.