ok, from memory this, I'll dig up code from an older computer if needed.
I set the car bodies with quite high in both normal damping and angulardamping, I think around 5.0. This means you need to use quite strong forces to move the car, but will prevent it looking like the car is on ice.
I then attached a pair of wheels to the back of the car with their own damping, the front pair is attached to an axle and get the angle from the steering angle. I applied the force running the car in the angle of the front tires. Must be a lot of force due to the physicsdamping.
In short how I made the car drift:
I compared the angles between where the car is going and where it is supposed to be going.
function getMovementAngle(sprite)
x# = getSpritePhysicsVelocityX(sprite)
y# = getSpritePhysicsVelocityY(sprite)
angle# = atanfull(x#,y#)
endFunction angle#
So, I normalized a float between 1.0-0.3 after comparing angles of the car and the angle of where the car is actually travelling. The "traction offset" of 1.0 would mean the car has perfect traction and the car would not drift, for example.
I then applied that float to the cars angulardamping and bodydamping variables, making it lose traction. I also set the same normalized float to the speed of the car in some way, or maybe it was the acceleration, so that the less "traction" you have the slower the car moves.
I also had a check for if the car is on dirt or on the track, and if the car is on dirt the "normalized traction float" would top out at maybe 0.6 instead of 1.0.
I hope this isn't too confusing, I just woke up and it feels like it's confusing to me
edit: the tire tracks are made with the same "normalized traction float", if it's under a certain value, let's say 0.5 (don't remember) black squares are set to where the back wheels are (array of sprites), and the alpha of them is the "normalized traction float" inverted
edit 2, clarification:
Let's say the car is traveling straight up, the wheels are pointed straight, angle 0. The force on the car body is applied at angle 0 because the wheels point that way.
The wheels then point to angle 25 when the player steers right ( the wheels are only allowed +- 20-30 degrees compared to the car body ), the body of the car will start to steer right, but not fast enough for there to be a difference between the angle the force is applied and the angle the body of the car is actually travelling, and the delta between these angles is what I used to make the car lose traction in those instances.
This means the speed of the car will also come into play, as a body travelling slower will be more likely to follow the direction of the force applied, where as a body travelling very fast will carry on going with momentum.
My hovercraft is full of eels