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(...))
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
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
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
Question Volume Spots inter group distance Sacryn 1 3 02-27-2024, 04:08 PM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Distance travelled across multiple splines jh092 1 7 02-23-2024, 09:44 AM
Last Post: _Aka_
  How to get travelled distance and distance to travel ommlmx 3 31 12-04-2023, 03:28 PM
Last Post: _Aka_

Forum Jump: