Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Closest Point on Spline (+Offset) to some World Position
#8
(01-25-2018, 02:15 AM)nomadigi Wrote: It seems like carTf is not increasing linearly.

It is indeed not linear in most cases, and this is normal.
If your are curious about why, take a look at this Wikipedia page, and notice how, in most cases, the point travels with different speeds depending if it is around the spline middle or around it's end.

So, your solution (setting the spline to linear) is not really one, since it will work only on linear splines. If you have a curved spline, you will meet the same problem again.

The real issue comes from how you define your car position:
Code:
float roadPosition = carTf * RoadSpline.Length;
It should be instead
Code:
float roadPosition = RoadSpline.TFToDistance(carTf)

Splines have often different versions of the same methods, one taking TFs as an input, and the other taking distances.

Let me know if this doesn't help.
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply


Messages In This Thread
RE: Closest Point on Spline (+Offset) to some World Position - by _Aka_ - 01-25-2018, 01:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Generator gameobjects missing offset and rotated beewhale 5 427 08-30-2026, 07:51 PM
Last Post: beewhale
  Spline Issue Leading to Unity Freeze Pankaj09 1 206 08-24-2026, 11:28 PM
Last Post: _Aka_
  Connecting Multiple Spline Nodes Issue Ritesh Kadam 1 165 08-22-2026, 11:24 PM
Last Post: _Aka_
  Spline Spots from 2 samples. BitBlit 8 1,083 06-30-2026, 11:49 AM
Last Post: _Aka_

Forum Jump: