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
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?
If I can figure this out, I'll get a major breakthrough in being able to use curved roads with my PhysX based cars
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
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?
If I can figure this out, I'll get a major breakthrough in being able to use curved roads with my PhysX based cars