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.
| Item | Meaning / 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 Handle | Resistance in N along the track. |
| Lever / Pedal / Knob / Joystick / Wheel / Crank | Resistance 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#
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.New related workflows#
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 / owner | Signature | Operation contract |
|---|---|---|
| JoltControl.get_resistance | JoltControl.get_resistance() | Finite nonnegative resistance: linear N, rotational N·m. Setter Boolean, getter number/undefined. |
| JoltControl.is_locked | JoltControl.is_locked() | Strict Boolean setter → Boolean; getter Boolean also false on error. Locks the mechanism, not the entire parent. |
| JoltControl.set_locked | JoltControl.set_locked(enabled) | Strict Boolean setter → Boolean; getter Boolean also false on error. Locks the mechanism, not the entire parent. |
| JoltControl.set_resistance | JoltControl.set_resistance(value) | Finite nonnegative resistance: linear N, rotational N·m. Setter Boolean, getter number/undefined. |