Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Distance from a World Point
#1
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?
Reply
#2
Hi
Does this answer your question?
spline.TfToDistance(spline.GetNearestPointTF(...))
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#3
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?
Reply
#4
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
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  12_Train junction point richardzzzarnold 5 827 04-16-2025, 02:19 PM
Last Post: _Aka_
  OnAfterControlPointAdded - Control Point is null jh092 5 1,003 02-04-2025, 09:31 PM
Last Post: _Aka_
  How to generate gameobject on the control point Yang Yi 1 463 12-10-2024, 10:14 PM
Last Post: _Aka_
Question Volume Spots inter group distance Sacryn 1 473 02-27-2024, 04:08 PM
Last Post: _Aka_

Forum Jump: