‹›
Vehicles

Brakes and Handbrake

Applies normalized service-brake and handbrake inputs through separate per-wheel torque limits.

The Boolean brake and handbrake wheel options select useful default torques; explicit max torque values remain authoritative.

Per-wheel configuration#

FieldDefaultMeaning
braketrueDefaults max_brake_torque to 1500 when true, otherwise 0.
max_brake_torque1500 or 0Non-negative service-brake torque.
handbrakefalseDefaults max_handbrake_torque to 4000 when true, otherwise 0.
max_handbrake_torque4000 or 0Non-negative handbrake torque.
GML
car.add_wheel(-0.8, -1.4, -0.2, {
    brake: true,
    max_brake_torque: 1800,
    handbrake: true,
    max_handbrake_torque: 4500
});

Runtime#

GML
car.set_brake(brake);          // clamped to 0..1
car.set_handbrake(handbrake);  // clamped to 0..1
  • A non-zero global brake input has no effect on a wheel whose corresponding maximum torque is zero.
  • Service brake is normally configured on all wheels; handbrake is commonly rear-only.
  • Braking performance also depends on tyre contact, load, friction and chassis mass.

Verified operation contracts#

These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.

Symbol / ownerSignatureOperation contract
JoltVehicle.set_brakeJoltVehicle.set_brake(value)Built live vehicle; Boolean. Throttle/steering clamp -1..1, brake/handbrake 0..1. Single setters preserve other inputs; set_inputs defaults brakes to 0.
JoltVehicle.set_handbrakeJoltVehicle.set_handbrake(value)Built live vehicle; Boolean. Throttle/steering clamp -1..1, brake/handbrake 0..1. Single setters preserve other inputs; set_inputs defaults brakes to 0.