Utility Scripts · Physical Controls

Absolute Position Motor

The absolute position motor moves Wheel/Crank to a specific multi-turn angle and then holds it.

GML
control.set_position_motor(options)
control.get_position_motor()
ItemMeaning / default
enabled / angletrue / 0°
directionOnly "absolute".
speed360 °/s; 0 < speed ≤ 10⁶
max_torque / frequency / damping10 N·m / 5 Hz / 1

angle is a finite logical angle within ±10¹²°. speed is a positive travel limit, not its sign; direction follows the difference between position and target. max_torque/frequency must be positive and damping nonnegative. Distant targets use a velocity travel stage, switching to a local spring drive near the target. An underpowered motor may stall under load.

Example#

GML
crank = jolt_control_crank({position_motor: {
    angle: 720, speed: 180, max_torque: 10, frequency: 5, damping: 1
}});
// After simulation:
var motor = crank.get_position_motor();
if (motor.active && motor.reached) show_debug_message("At target");

enabled describes the stored request; active describes current drive ownership. A higher priority may pause a motor. Position and phase also return mode: off / paused / velocity / position, reached, angle_tolerance (0.1°) and speed_tolerance (1°/s). reached evaluates the actual position and speed now; it is not a one-shot event, and a reached motor continues holding its target.

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_position_motorJoltControl.get_position_motor()Wheel/Crank; absolute logical angle ±1e12° default 0, speed (0, 1e6] °/s default 360, max_torque>0 default 10 N·m, frequency>0 default 5 Hz, damping>=0 default 1, enabled true. Setter Boolean; getter additionally mode off/paused/velocity/position, active, reached, tolerances and direction:absolute.
JoltControl.set_position_motorJoltControl.set_position_motor(options)Wheel/Crank; absolute logical angle ±1e12° default 0, speed (0, 1e6] °/s default 360, max_torque>0 default 10 N·m, frequency>0 default 5 Hz, damping>=0 default 1, enabled true. Setter Boolean; getter additionally mode off/paused/velocity/position, active, reached, tolerances and direction:absolute.