# Skidding

## The calculations behind losing grip and squealing tyres

This article details the extra calculations that the driving model performs when either the front or rear tyres are skidding. It is designed to be read alongside the core driving model calculations.

## Calculation 9: Apply rear tyre skidding ---------------------------------------

This is an explanation of calculation 9 in the driving model. It might help to see calculation 9 in context.

If the rear tyres are squealing (i.e. bit 7 of tyreSqueal is set) or the rear tyres were squealing in the last iteration of the main driving loop (i.e. bit 6 of tyreSqueal is set), then we make the sound of the tyres squealing and do the following calculations.

See code: ApplySkidForces

First, we recalculate the sideways force due to the sliding rear wheels, using a similar equation to the one we used for calculating the z-axis force in calculation 8, but this time in the x-axis and with a different calculation for (A T):

(NN MM) = scaled up |xVelocity|

(A T) = wingForce95 << 8

xTyreForceRear = max((A T), (NN MM)) * abs(-xVelocity)

The abs(-xVelocity) ensures that the force is against the direction of travel along the x-axis.

See code: GetTyreForces

Next, we recalculate the force along the z-axis, starting by calculating the variables that we use in the calculation:

• If the throttle is being applied:
(A T) = (throttleBrake * engineTorque) / 2

where throttleBrake is the amount of throttle being applied, and engineTorque is the engine torque from the previous iteration of the main driving loop (as set in calculation 21).
• If the throttle is not being applied:
(NN MM) = scaled up |zVelocity|

(A T) = throttleBrake * wingForce

See code: ApplySkidForces

Finally, we can recalculate the forces from the skidding rear tyre.

• If A >= wingForce95, set:
(A T) = wingForce95 << 8

xTyreForceRear = 0

• If the throttle is being applied, set:
zTyreForceRear = (A T) * abs(gearNumber - 1)

where abs(gearNumber - 1) is negative for reverse gear, and positive for all other gears.
• If the throttle is not being applied, set:
zTyreForceRear = max((A T), (NN MM)) * abs(-zVelocity)

The abs(-zVelocity) ensures that the force is against the direction of travel along the z-axis.

## Calculation 11: Apply front tyre skidding -----------------------------------------

This is an explanation of calculation 11 in the driving model. It might help to see calculation 11 in context.

If the front tyres are squealing (i.e. bit 7 of tyreSqueal is set) or the front tyres were squealing in the last iteration of the main driving loop (i.e. bit 6 of tyreSqueal is set), then we make the sound of the tyres squealing and do the following calculations.

See code: ApplySkidForces

First, we recalculate the sideways force due to the sliding front wheels, using a similar equation to the one we used for calculating the z-axis force in calculation 8, but this time in the x-axis and with a different calculation for (A T):

(NN MM) = scaled up |xVelocity|

(A T) = wingForce95 << 8

xTyreForceRear = max((A T), (NN MM)) * abs(-xVelocity)

The abs(-xVelocity) ensures that the force is against the direction of travel along the x-axis.

See code: GetTyreForces

Next, we recalculate the force along the z-axis, starting by calculating the variables that we use in the calculation:

• If the throttle is being applied, stop applying the skidding calculations and jump to calculation 12.
• If the throttle is not being applied:
(NN MM) = scaled up |zVelocity|

where throttleBrake is the amount of throttle being applied.

See code: ApplySkidForces

Finally, we can recalculate the forces from the skidding rear tyre.

• If A < wingForce95, then:
(A T) = throttleBrake * wingForce * 3 / 4

zTyreForceNose = max((A T), (NN MM)) * abs(-zVelocity)

• If A >= wingForce95, then:
(A T) = wingForce95 << 8

zTyreForceNose = max((A T), (NN MM)) * abs(-zVelocity)

The abs(-zVelocity) ensures that the force is against the direction of travel along the z-axis.