Utility Scripts · Physical Controls

Knob

Knob is a rotary dial with end stops and a normalized output.

ItemMeaning / default
initial_angleAngle in degrees within min/max limits; defaults to 0.
GML
jolt_control_knob(options=undefined)

Call jolt_start() before creation. Every factory accepts one optional options struct and returns JoltControl, or undefined on error. Common options: parent, position/rotation or local_position/local_rotation, mass, resistance and output. Dimensions are full lengths in metres, mass is in kg; this API uses degrees for angles. See Mounting, Size and Rendering for shared configuration.

ItemMeaning / default
size{radius:0.2, depth:0.1}
mass0.5 kg
min_angle / max_angle−80° / 80°
auto_return / targetfalse / 0.5
drive{max_torque:10, frequency:4, damping:1}
detents[]

The cylinder is centred on its pivot and rotates around local +Z. Limits must contain zero and satisfy 0 < max_angle − min_angle < 180°. get_value() maps this limited range to 0..1. Choose Wheel for free multi-turn rotation.

target is a canonical value in 0..1. set_target() alone only stores the target; enable the drive with auto_return: true or set_auto_return(true). The body moves towards it physically; creation does not place the body at target.

Example#

GML
knob = jolt_control_knob({
    min_angle: -70, max_angle: 70,
    resistance: 0.15,
    output: {min: 20, max: 200, inverted: false}
});
var temperature = knob.get_output_value();

Current project integrations#

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
jolt_control_knobjolt_control_knob(options=undefined)Requires managed world, optional options, returns owning JoltControl or undefined. Without parent world position/rotation; with parent local_position/local_rotation, do not mix. Knob: radius.2/depth.1 m, mass.5 kg, min/max -80/80°, initial0, auto_return false, target.5.