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
  Curvy Line Renderer for UI Spline? gekido 1 1 9 hours ago
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 2 9 hours ago
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_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: