‹›
Utility Scripts · Physical Controls

Locking and Resistance

Locking holds the current physical pose; resistance opposes movement with a force or torque that can be overcome.

ItemMeaning / default
set_locked(enabled) / is_locked()Boolean; locking creates a Fixed constraint to the parent or world at the current pose.
set_resistance(value) / get_resistance()Finite nonnegative value; 0 disables resistance. Default 0.
Button / Slider / Pull HandleResistance in N along the track.
Lever / Pedal / Knob / Joystick / Wheel / CrankResistance in N·m for permitted rotational movement.

Resistance is a separate mechanical brake with a bounded impulse. It is not a spring or ordinary speed-dependent damping; it can hold a small load even at rest. It operates alongside an active motor. Fixed locking pauses the main mechanism and resistance, so stored configuration cannot drive the body while locked.

Example#

GML
wheel = jolt_control_wheel({resistance: 0.5});
wheel.set_locked(true);
wheel.set_speed_motor({speed: 90, max_torque: 5});
// The request is stored; the wheel stays locked.
wheel.set_locked(false);
// The next physics update restores the highest eligible drive.

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_resistanceJoltControl.get_resistance()Finite nonnegative resistance: linear N, rotational N·m. Setter Boolean, getter number/undefined.
JoltControl.is_lockedJoltControl.is_locked()Strict Boolean setter → Boolean; getter Boolean also false on error. Locks the mechanism, not the entire parent.
JoltControl.set_lockedJoltControl.set_locked(enabled)Strict Boolean setter → Boolean; getter Boolean also false on error. Locks the mechanism, not the entire parent.
JoltControl.set_resistanceJoltControl.set_resistance(value)Finite nonnegative resistance: linear N, rotational N·m. Setter Boolean, getter number/undefined.