Utility Scripts · Physical Controls

Slider

Slider is an analogue control on a straight track without a separate pressed state.

ItemMeaning / default
initial_valueActual initial position in 0..1; defaults to 0.
GML
jolt_control_slider(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{x:0.2, y:0.2, z:0.1}
mass / travel1 kg / 1 m
auto_return / targetfalse / 0.5
drive{max_force:20, frequency:4, damping:1}
detents[]

The origin is the slider centre at the start of its track. Its value increases from 0 to 1 along mounting −Z; travel must be positive. The factory creates only a moving box and constraint guidance; render a rail separately. cap_size and Button thresholds are unsupported.

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
slider = jolt_control_slider({
    travel: 0.4,
    rotation: {x: 0, y: -0.70710678, z: 0, w: 0.70710678},
    output: {min: 0, max: 100},
    resistance: 2
});
var volume_percent = slider.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_sliderjolt_control_slider(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. Slider: size .2/.2/.1 m, mass1 kg, travel1 m, target.5, auto_return false.