Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Aligning objects from points on spline
#2
Hi
There might be some mathematical formula that gives you, given a spline, a distance D and a point A on the spline, gives you a point B that is at linear distance of D from A. If such formula exists, I am not aware of it. If you need crazy precision, that would be the path to explore, but I guess that you don't need such level of precision.

The easier solution is to go through all the cache points of the spline (yourspline.GetApproximation), and test their linear distance with the point A, and take the point which distance is closer to D.
You can improve precision by instead of taking that point, to search linearly between two points B1 and B2, B1 being the one with a distance directly under D, and B2 being the point with a distance directly above D.
You can improve performance by searching just the cache point between two tf values, tf1 and tf2. tf1 would be the tf of point A, and tf2 would be the tf of the point that has a non-linear distance of D on the spline from point A.

Sorry, I don't have any simpler solution (besides the method used in the train example scenes)
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Messages In This Thread
Aligning objects from points on spline - by Lupp_ - 02-18-2021, 04:08 PM
RE: Aligning objects from points on spline - by _Aka_ - 02-19-2021, 02:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 8 1,367 04-12-2026, 03:18 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 661 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,464 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 6,237 07-13-2025, 07:11 PM
Last Post: _Aka_

Forum Jump: