Linear Algebra – How to Calculate Speed for Taking a Turn Given Turn Angle and Current Speed

geometrylinear algebramathematical physicsphysics

I'm working on AI vehicle movement for a game. This is an open terrain game so the vehicles are not using a predefined track. The AI is given a list of waypoints that they must follow believably. Right now they kinda are but they need to adjust their speed for corners, so I need some help trying to figure out the correct speed they should be going during turns.

The variables I am currently working with are: the angle for the next turn (if several turns are close together I add them to the current turn angle), the current speed, the braking distance, gravity, and friction between the ground and the vehicle.

I saw this post but I wasn't sure how Ri and Ro played into my way-point list:
Car racing: How to calculate the radius of the racing line through a turn of varying length

Any help would be really appreciated!

Best Answer

A reasonable model is that you can accelerate up to some limit in any direction-forward, backward (braking), or sideways (turning). If $v$ is the speed you are running and $a$ is the acceleration limit, the acceleration due to turning is $\frac {v^2}r=\omega^2r$ where $\omega$ is the angular velocity, $\omega=\frac vr$. I did the problem once and convinced myself that if you want to make a U turn it is worth decelerating to zero speed, making a sharp corner, and accelerating back to speed. There is some smaller angle where you should just make the turn at speed because the decelerate/accelerate is a fixed cost while the time saved turning is proportional to the turn angle. A reasonable acceleration limit for cars is $0.8-1$g.