Vehicles
Chassis and Coordinates
Uses an existing Dynamic JoltBody as the physical chassis, while wheels remain virtual controller data.
A stable car begins with a correctly oriented collision shape, realistic mass and a center of mass below the visual center. Ordinary body layer, material and CCD settings remain authoritative.
Required chassis state#
| Requirement | Reason |
|---|---|
| Dynamic motion type | The vehicle controller applies forces and impulses to the chassis. |
| Sensor disabled | A sensor cannot act as a physical vehicle chassis. |
| Live managed body | Stale, destroyed or explicit-world handles are rejected. |
| Movable shape | Box, Sphere, Capsule, Cylinder, tapered, Convex and Compound follow normal dynamic-body rules. |
Orientation#
- Model the front of the chassis along local +Y.
- Use local X for left/right wheel placement and local Z for height.
- Wheel hard points supplied to add_wheel() are chassis-local coordinates.
- The public world remains right-handed and Z-up even when the chassis rotates.
Mass and center of mass#
chassis = jolt_box_create_dynamic(0, 0, 1.1, 1.8, 4.0, 0.5, {
mass: 1200,
friction: 0.8,
center_of_mass_offset: { x:0, y:0, z:-0.25 },
ccd: true
});Lowering center_of_mass_offset usually reduces roll-over tendency. Excessively low values can make the car unnaturally resistant to weight transfer. Tune suspension and anti-roll stiffness after establishing mass and center of mass.
Body properties that still matter#
- The chassis object layer determines which surfaces wheel queries may hit.
- Mass and inertia determine acceleration, braking, steering response and body roll.
- Friction and restitution still affect direct chassis impacts; tyre traction uses wheel friction curves.
- LinearCast CCD can protect a fast chassis, but it is not full rotational CCD.