I'm in the early stages of a city driving simulation project, and I'm having trouble with the math to determine how the AI should steer the cars. My car model is very simple, with nothing like physical wheels or friction; the AI simply sets a turning radius (FLT_MAX means drive straight) and an acceleration each frame. My question is, given a starting position and direction, how do I work out the turning radius each frame to have the car arrive at a destination position and direction? As an example, think of a car stopped at a stop sign ready to turn right around the corner. The car should follow a curve so that is is pointing along the road onto which it is turning when it arrives at the "start" of that road.
I think Bezier curves would be helpful, since they can be used to create smooth curves that are tangent to my initial and final directions, but I can't work out exactly how to pick a point a little way ahead along the curve to aim for. I also open to completely different ideas.
Here's my car update code for reference.
mSpeed += mAcceleration * deltaTime; float distance = mSpeed * deltaTime; float theta = distance / mTurningRadius; mPosition += mTurningRadius * sin(theta) * mDirection + mTurningRadius *(1.0f - cos(theta)) * mLeft; mDirection = rotate(mDirection, theta * 180.0f / PI, mUp); mLeft = -cross(mDirection, mUp);