Simulating Tyre Slip Using Pacejka's Magic Formula

Simulating realistic vehicle handling in racing games requires calculating the forces generated where the rubber meets the road. Physics programmers achieve this by implementing Hans Pacejka's Magic Formula, an empirical mathematical model that defines the non-linear relationship between tyre deformation (slip) and the resulting friction forces (lateral and longitudinal). By measuring dynamic inputs such as wheel angular velocity, vehicle velocity, and vertical load, developers map slip values through Pacejka’s curve functions to produce the distinct grip, peak, and slide characteristics of a real performance tyre.

Understanding Slip: The Formula's Inputs

Tyres do not act as rigid bodies; they flex under acceleration, braking, and steering. This deflection produces two fundamental inputs required by the Magic Formula:

  1. Slip Ratio (\(\kappa\) or \(s_x\)): The difference between the rotational speed of the tyre and the linear ground speed of the vehicle. It determines longitudinal force (\(F_x\)) for acceleration and braking.
  2. Slip Angle (\(\alpha\) or \(s_y\)): The angle between the direction the wheel is pointing and the direction the wheel is actually travelling. It dictates lateral cornering force (\(F_y\)).

To calculate these, the physics engine takes the local wheel contact patch velocity (\(V_x, V_y\)) and the wheel's rotational velocity (\(\omega\)) multiplied by the tyre's rolling radius (\(R\)):

  • Longitudinal slip: \(\kappa = \frac{\omega R - V_x}{|V_x|}\)
  • Lateral slip: \(\alpha = -\arctan\left(\frac{V_y}{|V_x|}\right)\)

Programmers usually add a small epsilon to the denominator to prevent division-by-zero errors when the vehicle is stationary.

The Magic Formula Equation

The basic "Pacejka 89" or "Pacejka 94" formulation defines tyre force \(y(x)\) using an algebraic equation governed by four main coefficients:

\[y(x) = D \cdot \sin(C \cdot \arctan(B \cdot x - E \cdot (B \cdot x - \arctan(B \cdot x))))\]

Where:

  • \(x\) is the input slip (slip ratio \(\kappa\) or slip angle \(\alpha\)).
  • \(y(x)\) is the output force (longitudinal force \(F_x\) or lateral force \(F_y\)).
  • \(B\) (Stiffness Factor): Determines the slope of the curve at zero slip. It dictates how quickly the tyre builds grip.
  • \(C\) (Shape Factor): Governs the overall profile of the curve, controlling the transition limits (typically around 1.3 to 1.9).
  • \(D\) (Peak Value): Defines the maximum achievable friction force. This is heavily dependent on normal load (\(F_z\)) and the surface friction coefficient (\(\mu\)).
  • \(E\) (Curvature Factor): Modulates the curve's sharpness at the peak and controls the transition from maximum grip into a slide.

Curve Behavior: Grip, Peak, and Slide

Pacejka’s formulation accurately reproduces three distinct driving regimes:

  1. Linear Zone (Low Slip): At small slip values, the tyre tread stretches elastically without sliding. The curve rises sharply and linearly.
  2. Peak Grip (Limit of Handling): At a critical slip value (typically 6° to 10° for slip angle, or 10% to 15% for slip ratio), the tyre achieves maximum grip (\(D\)). Drivers perceive this as the threshold of grip.
  3. Sliding Zone (Over the Limit): Beyond the peak, the tread begins to dynamically slide against the asphalt. The curve drops to an asymptote, representing reduced sliding friction. The drop-off rate is regulated by the curvature factor (\(E\)), determining whether a car snaps aggressively into a spin or slides progressively.

Load Sensitivity and Dynamic Corrections

The peak force \(D\) does not scale linearly with weight. Real tyres exhibit "tyre load sensitivity," where increasing vertical load (\(F_z\)) increases total grip, but decreases the tyre's friction coefficient (\(\mu = F/F_z\)).

Physics programmers scale the coefficients dynamically within the simulation loop based on:

  • Vertical Load (\(F_z\)): Derived from the vehicle suspension spring and damper forces.
  • Camber Angle (\(\gamma\)): Camber modifies the lateral force curve by shifting the horizontal origin (camber thrust).
  • Surface Grip Modifier: Ground types (asphalt, gravel, wet track) scale down \(D\) and alter \(B\) to represent lower peak grip and less responsive stiffness.

Combined Slip (The Friction Ellipse)

In real driving, a tyre cannot deliver 100% of its braking force and 100% of its cornering force simultaneously. Pacejka accounts for this via combined slip equations.

To maintain real-time performance without implementing the full, computationally heavy Pacejka 2002 combined formulations, physics programmers often normalize the slip vectors using the concept of a friction circle (or ellipse):

\[\text{Slip}_{\text{total}} = \sqrt{\left(\frac{\kappa}{\kappa_{\text{peak}}}\right)^2 + \left(\frac{\alpha}{\alpha_{\text{peak}}}\right)^2}\]

If the combined demand exceeds available traction, both forces are scaled back proportionally to ensure the resultant force remains bounded within the tyre's operational limits.

Application in the Physics Update Loop

During each fixed update cycle (typically 120Hz to 1000Hz in competitive simulators), the engine executes the following steps:

  1. Perform a raycast or swept-sphere check from the wheel hub to detect contact with the terrain.
  2. Calculate suspension compression to compute the normal load (\(F_z\)).
  3. Query ground velocity and wheel rotational speed to determine \(\kappa\) and \(\alpha\).
  4. Pass these slip values into the Magic Formula functions alongside the load-adjusted coefficients (\(B, C, D, E\)).
  5. Apply the resulting horizontal forces (\(F_x, F_y\)) to the vehicle's rigid body at the contact patch coordinate.
  6. Feed the opposing longitudinal reaction torque back into the wheel assembly to accurately simulate wheel spin, lock-up, and drivetrain resistance.