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)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: