WheelCollider
Raycast-based wheel collider (Unity-style). Add to a child entity of a rigid body; the system finds the nearest ancestor with a `Physics` component and applies suspension, drive, and friction forces to it.
WheelCollider
Raycast-based wheel collider (Unity-style). Add to a child entity of a rigid body; the system finds the nearest ancestor with a Physics component and applies suspension, drive, and friction forces to it.
Drive conventions: positive motorTorque drives toward the parent body's local -Z (the engine's forward); positive steerAngle steers right.
Suspension springRate/damperRate are clamped per step to what the chassis mass can integrate stably, so an over-stiff spring on a light body settles instead of oscillating — tune rates to the vehicle's mass for the intended feel.
Public fields: suspensionDistance, springRate, damperRate, targetPosition, radius, width, motorTorque, brakeTorque, steerAngle, forwardFriction, sidewaysFriction, rollingResistance, is2D. Runtime-read-only (updated every physics tick): isGrounded, compression, angularVelocity — also readable via Physics.getWheelState(wheelId).
Methods: setMotor(torque), setBrake(torque), setSteer(angle).
entity(wheelId).component.add("WheelCollider", {
radius = 0.3,
suspensionDistance = 0.3,
springRate = 35000,
damperRate = 4500,
})
Scoped to this part · feeds back into the world's score.