Utility Scripts · Physical Controls

Crank

Crank uses one rigid compound with an arm and handle that can rotate without limits.

GML
jolt_control_crank(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
arm_length0.5 m
arm_size{width:0.08, depth:0.08}
handle_radius / handle_length0.08 m / 0.18 m
mass / resistance1 kg / 0 N·m

The arm extends from the pivot along +X; width is its Y dimension and depth its Z dimension. The handle sits at the arm end along +Z. All dimensions must be positive; size is unsupported. Mass applies to the entire compound. The public origin is the pivot; centre of mass and inertia reflect both parts. The handle does not spin independently.

Wheel and Crank accept periodic_detents, absolute_detents, speed_motor, position_motor, phase_motor and torque_mode. All are disabled by default. They do not accept auto_return, target, drive, detents, min_angle, max_angle, initial_phase or initial_turns. Use the continuous drive methods instead.

Example#

GML
crank = jolt_control_crank({
    arm_length: 0.4,
    arm_size: {width: 0.06, depth: 0.06},
    handle_radius: 0.04,
    handle_length: 0.15,
    resistance: 0.2
});
var completed_turns = crank.get_turns();

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_crankjolt_control_crank(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. Crank: arm_length.5m, arm_size .08/.08m, handle_radius.08, length.18m, mass1kg; arm +X, handle +Z. Continuous rotation as Wheel.