Wheels are a constraint system.
This route turns Rapier's ray-cast vehicle controller into a small driving laboratory: the chassis is a dynamic rigid body, wheels raycast through suspension, and engine, steering, friction, and brake writes become measurable state.
Preparing the Rapier world, chassis, wheels, and vehicle controller...
- physics
- -
- bodies
- -
- wheels
- -
- speed
- -
- steering
- -
- engine
- -
- brake
- -
- fps
- -
Click a direction to toggle it; press the same button again to idle. Keyboard input mirrors the official WASD/arrow control path.
await RapierPhysics()create gravity worldphysics.addMesh(chassis, 10, ...)register dynamic chassisworld.createVehicleController(chassis)create ray-cast controllervehicle.addWheel(...)define suspension raysetWheelEngineForce(...)apply drive forcesetWheelSteering(...)set steering anglesetWheelBrake(...)apply braking impulseupdateVehicle(dt)integrate vehicle forceswheelSuspensionLength(...)sync visible wheelnew RapierHelper(world)inspect collider topologyThe chassis remains a normal dynamic rigid body. The controller adds wheel raycasts and directly updates chassis velocity; wheel meshes are visual children whose suspension and rotation are read from controller telemetry.
Rapier is loading. Wheel contact, suspension, and impulse telemetry become available after the controller owns the chassis.
Based on the official Rapier vehicle-controller example and JavaScript ray-cast vehicle API. The CPU fallback preserves the interaction labels, but it does not claim suspension or wheel-contact parity.