Jump to content
  • Advertisement
Sign in to follow this  
JohnOwens_137089

Using a Catmul Rom spline for steering assist

This topic is 2608 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm looking to use a Catmull Rom spline for steering assist in a driving game.

Currently I compute the spline and then use linear interpolation along the 2nd and 3rd control points to determine t.

i.e.

vector3df v2toV3 = v3 - v2;

f32 t = v2toV3.getLength();

v2toV3.normalize();

vector3df v2topos = GetTrans().GetPosition() - v2;

t = Boundval( 0.0f, v2topos.dotProduct( v2toV3 ) / t, 1.0f );


Which I then use to determine the point along the spline and I use that to feed into a pid controller

My problem is the linear interpolation to detemine t. As this value could be slightly behind or ahead of the car's position depending on the curvature of the spline.

What I really need is a way of determining the position along the spline that intersects the shortest line from the car to the line between the two control points.

If any of that makes sense? :-)

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!