Car mechanics

#programming
A note on general car and drift mechanics inside video games
Trying to focus on arcade style rather than current AAA titles.

Warning

All descriptions below are analogies, or best attempts at recreating certain physics inside video games. They are not representative of real life physics.

Steering

When a car is being steered, the rotation of the car changes ever so slightly in an update loop, but the logic behind it is what's important

Essentially, we tend to rotate the car a center of rotation when a non-zero steering is applied.
This center of rotation is not on the car, and is not a constant point.
This circle is what defines the "radius of rotation".

In fact, it is the intersection of the ray-casts of the axes of the front and rear wheels.

Essentially, this
car_steering.png

Note here that the circle is formed rear-wheel as tangents and axis of rear wheel as radius. The front wheel help in locating the center, but are themselves not on the circle.

Also note here that both of the front tires are not aligned perfectly.
Since this is an approximation at best, we consider the front tire towards the side we are rotating, and rotate both front wheels by the same θ, which is clearly inaccurate. (in this simulation atleast)

The closer the COR is to the rear wheels, the tighter the turn is.

Drifting

It occurs when, while steering and actively rotating about some arbitrary COR, the centrifugal forces due to velocity exceeds maximum static friction that the tires can provide sideways.

Important

Not aware of the full implementation and logic yet, to be filled later
But hint for now :
Think in direction of momentum to make a more realistic drifting effect. We need the weight of the car to be felt, something that tries to keep going in a previous direction than where I am going now.

Powered by Forestry.md