Utility Scripts · Physical Controls

Speed Motor

The speed motor maintains a requested relative Wheel/Crank speed using bounded torque.

GML
control.set_speed_motor(options)
control.get_speed_motor()
ItemMeaning / default
enabledtrue
speed0 °/s; finite signed value within ±10⁶ °/s.
max_torque10 N·m; finite positive value.
activeGetter only: whether this motor currently owns the drive.

Example#

GML
wheel = jolt_control_wheel({speed_motor: {speed: 120, max_torque: 5}});
var request = wheel.get_speed_motor();
request.speed = -60;
wheel.set_speed_motor(request);
// Torque-limited brake:
wheel.set_speed_motor({speed: 0, max_torque: 5});
// Release the motor:
wheel.set_speed_motor({enabled: false});

speed is a target; get_speed() returns actual speed. Zero actively brakes; enabled:false releases the drive. The motor does not directly overwrite body velocity, so insufficient torque causes slowing or stalling under load. Relative speed is measured against the parent, or the world.

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
JoltControl.get_speed_motorJoltControl.get_speed_motor()Wheel/Crank; enabled true, speed default 0 within ±1000000 °/s, max_torque >0 N·m default 10. Setter Boolean; getter {enabled, speed, max_torque, active} or undefined.
JoltControl.set_speed_motorJoltControl.set_speed_motor(options)Wheel/Crank; enabled true, speed default 0 within ±1000000 °/s, max_torque >0 N·m default 10. Setter Boolean; getter {enabled, speed, max_torque, active} or undefined.