Table of Contents

Struct ChassisBodyRollSystem

Namespace
LibreRally.Vehicle.Physics
Assembly
LibreRally.dll

Computes chassis body attitude torque from suspension compression differences.

For each axle the compression delta between left and right wheels generates a roll moment about the vehicle's longitudinal axis:

τ_roll = (compression_left − compression_right) × rollStiffness

The average front-versus-rear compression difference also generates a pitch moment about the vehicle's lateral axis:

τ_pitch = (avgFrontCompression − avgRearCompression) × pitchStiffness

The resulting torques are applied as angular impulses to the chassis body each physics step, producing visible body lean and dive/squat from the measured suspension state rather than from arbitrary visual offsets.

This is a reduced-order, torque-based body attitude model. It approximates the sprung-mass response from compression and acceleration terms and does not model full multi-body suspension kinematics (control-arm geometry, instant centers, etc.).

Design constraints:

  • Zero per-frame allocations — struct with no heap state.
  • Fixed-timestep safe — torque is converted to an impulse using the caller's dt.
  • Compatible with VehicleDynamicsSystem suspension compression arrays.

Reference: Milliken & Milliken, "Race Car Vehicle Dynamics", §17 — Roll stiffness and suspension geometry.

public struct ChassisBodyRollSystem
Inherited Members

Fields

FrontRollStiffness

Front axle roll stiffness (N·m/m). Torque per metre of left-right compression difference.

public float FrontRollStiffness

Field Value

float

PitchDampingCoefficient

Viscous pitch damping coefficient (N·m·s/rad). Resists dive/squat oscillation.

public float PitchDampingCoefficient

Field Value

float

PitchStiffness

Pitch stiffness (N·m/m). Torque per metre of front-vs-rear average compression difference.

public float PitchStiffness

Field Value

float

RearRollStiffness

Rear axle roll stiffness (N·m/m). Torque per metre of left-right compression difference.

public float RearRollStiffness

Field Value

float

RollDampingCoefficient

Viscous roll damping coefficient (N·m·s/rad). Resists rate of roll change to prevent oscillation.

public float RollDampingCoefficient

Field Value

float

Methods

Apply(BodyComponent, Vector3, Vector3, ReadOnlySpan<float>, float, float, float)

Computes and applies chassis body roll torque from suspension compression differences.

Call once per physics step after suspension compressions have been measured and before tyre force application.

public void Apply(BodyComponent chassisBody, Vector3 chassisForward, Vector3 chassisRight, ReadOnlySpan<float> suspensionCompressions, float rollAccelerationTorque, float pitchAccelerationTorque, float dt)

Parameters

chassisBody BodyComponent

BEPU rigid body for the chassis.

chassisForward Vector3

Unit vector along the chassis longitudinal (forward) axis in world space.

chassisRight Vector3

Unit vector along the chassis lateral (right) axis in world space.

suspensionCompressions ReadOnlySpan<float>

Per-wheel suspension compression (m). Indexed by VehicleDynamicsSystem wheel constants.

rollAccelerationTorque float

Additional roll moment (N·m) from lateral acceleration/load transfer of the sprung mass.

pitchAccelerationTorque float

Additional pitch moment (N·m) from longitudinal acceleration/load transfer of the sprung mass.

dt float

Physics timestep in seconds.