I am learning programming for computer games and it seems i am struggling to work out an equation for a steering behaviour.

I have a vehicle that navigates around objects. Some times it has to take a really sharp turn and so has to slow down before it approaches this turn to take it without over/under steering. It may even need to stop completely whilst its rotating (like a tank would).

I am wondering how you can calculate the best approach speed to take a given corner/angle.

I have 3 properties for the vehicle, a max speed, an acceleration (same for increasing and decreasing the speed) and a rotation speed.

Is there any general equation that can help with this that i can then try to translate into code.

  • $\begingroup$ My question had nothing to do with banked curves... nor does that link really talk /show how to find the correct velocity to slow to depending on sharpness of the turn in any mathematical way. $\endgroup$ – WDUK Feb 11 '18 at 6:39
  • $\begingroup$ The link does provide a formula linking speed and radius of turn. If that is not what you want then I do not understand what you are asking for. Are you trying to avoid skidding if friction is insufficient? If so you need to provide a coefficient of friction. If not, how do you decide what is the best approach speed? $\endgroup$ – sammy gerbil Feb 11 '18 at 20:13
  • $\begingroup$ Might Game Development be better suited for this question? $\endgroup$ – Kyle Kanos Feb 12 '18 at 11:20

Assuming curve radius is known, as it should be from the graphics setup process, you should be able to do it by comparing two linear speeds. One linear speed would be defined by the actual curve dimensions and the vehicle's maximum rotational speed, to give you the maximum allowed speed if the vehicle is to not overshoot the road curve arc (by following an arc with a larger radius than the curve). The second speed would be the car's actual speed coming into the curve. The car should not exceed its maximum allowed speed.

You can use the equation for an arc traced by a rotating object, where velocity is:

$v = r\omega$

where in this case v equals the maximum permissible linear speed, $r$ is curve radius, $\omega$ is the maximum angular speed or rotational speed in radians/second of the vehicle in this case.


Not the answer you're looking for? Browse other questions tagged or ask your own question.