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; aX = (momentum * Math.cos(radians)); aY = (momentum * Math.sin(radians)); newX = playerX + aX, newY = playerY + aY
I can get skid by introducing a velocity variable; for example:
radians = rotation * Math.PI / 180; aX = (momentum * Math.cos(radians)); aY = (momentum * Math.sin(radians)); 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?