# How to implement a slight skid in a car game

I have a top down car game, where I'm trying to allow a slight skid; I've tried the following code to calculate the X and Y, but there is no skid whatsoever:

radians = rotation * Math.PI / 180;

newX = playerX + aX,
newY = playerY + aY


I can get skid by introducing a velocity variable; for example:

radians = rotation * Math.PI / 180;

velocityX = velocityX + aX;
velocityY = velocityY + aY;

newX = playerX + velocityX;
newY = playerY + velocityY;


This introduces far too much skid, like the car is on ice. I've tried reducing the amount I increase the velocity by:

velocityX = velocityX + (aX / 3);


Which sort of works initially, but still ends up ice skating and uncontrollable after playing around for a few minutes.

Are there any techniques for introducing a slight skid without this extreme side effect?

There are different physical effects of skiding but most probably you want to implement understeering, i.e. that the car turns not enough when in a curve and leaves the road or something like this.

Your car does not seem to have any orientation on the ground, it's probably modeled as a point.

You add the momentum to the position, that must mean that you set the mass to one and also the time interval between position updates.

The way to introduce understeering is keeping a fraction of the old movement vector when applying the new movement vector.

skid_factor = 0.5; // adjust that

radians = rotation * Math.PI / 180;

skid_factor = 1 - (velocityX*aX+velocityY*aY)^2/(aX^2+aY^2)/(velocityX^2+velocityY^2)