Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Closest Point on Spline (+Offset) to some World Position
#1
Hi,

I'm working on a driving action game. I'd been using Curvy to control the cars along the spline, but for several reasons, I switched to PhysX based cars. I finally have them working the way I want on straight roads, but of course I want curvy roads in my game, and I'm using Curvy to do that Smile

For this reason I'm wondering how it might be possible to get the closest point on the road spline to some carTransform.position. My roads are curvy spline based and use a coordinate system of normal Curvy Position + and offset (called Lane Position). The offset is very important to this because for lane tracking of course.

So in the image below, imagine that green car squiggle is a gameobject not controlled by a Curvy controller. However I want to know its current "Road Position"
Assuming a Lane width of 3 (so range of -6 to 6 of Lane position) that car would be at SplinePosition "P" and LanePosition 1.5f. (just eyeballing it)

How can I find this out programatically given the car's transform position?


[Image: QB7VYkx.png]


If I can figure this out, I'll get a major breakthrough in being able to use curved roads with my PhysX based cars Smile
Reply


Messages In This Thread
Closest Point on Spline (+Offset) to some World Position - by nomadigi - 01-23-2018, 06:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 8 1,392 04-12-2026, 03:18 PM
Last Post: _Aka_
  Control Point Interpolation Overrides. rickgplus 1 538 12-11-2025, 08:52 AM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 662 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,467 07-29-2025, 09:15 PM
Last Post: _Aka_

Forum Jump: