Utility Scripts · Physical Controls

Pedal

Pedal creates a raised plate that folds down around its rear edge when pressed.

GML
jolt_control_pedal(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.4, y:0.7, z:0.08}
mass / travel_angle2 kg / 30°
auto_return / targettrue / 0
drive{max_torque:20, frequency:4, damping:1}
detents[]

Mount rotation describes the fully pressed plate plane. The plate extends from the pivot along +Y and starts raised by travel_angle; pressing is positive rotation about mounting −X. travel_angle must be greater than 0 and less than 180°. This type rejects min_angle and max_angle. get_value() means 0 released, 1 pressed.

Example#

GML
pedal = jolt_control_pedal({
    travel_angle: 25,
    output: {min: 0, max: 100},
    resistance: 0.2
});
var brake_percent = pedal.get_output_value();

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.

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_pedaljolt_control_pedal(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. Pedal: size .4/.7/.08 m, mass2 kg, travel_angle30° (0, 180), auto_return true, target0; rejects min/max_angle.