Utility Scripts · Physical Controls

Phase Motor

The phase motor selects a concrete target orientation in the requested direction and holds the selected turn.

GML
control.set_phase_motor(options)
control.get_phase_motor()
ItemMeaning / default
enabled / phasetrue / 0; 0 ≤ phase < 1
direction"shortest" / "positive" / "negative"; default "shortest"
speed360 °/s; 0 < speed ≤ 10⁶
max_torque / frequency / damping10 N·m / 5 Hz / 1
resolved_angleGetter only: selected absolute logical target in degrees.

phase:0.25 means a quarter turn. 1 is invalid; use phase 0 for a whole turn. shortest chooses the shorter path and the positive direction for an exact half-turn tie. positive selects a target in the positive direction and negative in the negative direction. This chooses a target turn; it is not a persistent one-way drive.

Example#

GML
wheel = jolt_control_wheel({phase_motor: {
    phase: 0.25, direction: "shortest", speed: 90, max_torque: 5
}});
var motor = wheel.get_phase_motor();
show_debug_message(motor.resolved_angle);

The target turn is retained. Overshoot, higher-priority pauses and changes to effort or speed do not change it. Resolution occurs on first configuration, phase/direction changes, re-enabling and set_zero(). This prevents unintentionally chasing another turn after a small overshoot.

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_phase_motorJoltControl.get_phase_motor()Wheel/Crank; phase [0, 1) default 0, direction shortest/positive/negative default shortest. Dynamics as position_motor. Setter Boolean; getter config + mode/active/reached/tolerances/resolved_angle, undefined for invalid/incompatible object.
JoltControl.set_phase_motorJoltControl.set_phase_motor(options)Wheel/Crank; phase [0, 1) default 0, direction shortest/positive/negative default shortest. Dynamics as position_motor. Setter Boolean; getter config + mode/active/reached/tolerances/resolved_angle, undefined for invalid/incompatible object.