Utility Scripts · Physical Controls

Periodic Detents

Periodic detents repeat the same number of holding positions on every Wheel or Crank turn.

GML
control.set_periodic_detents(options)
control.get_periodic_detents()
control.get_periodic_detent()
ItemMeaning / default
countRequired integer 1..3600. Step = 360/count degrees.
capture_anglemin(5, step × 0.2)
release_anglemin(10, step × 0.4)
max_torque / frequency / damping5 N·m / 8 Hz / 1

Require 0 < capture_angle ≤ step/2 and capture_angle < release_angle < min(step,45°). Torque and frequency must be positive, damping nonnegative. Zones use degrees; capture_range, release_range and step_angle do not belong here. false disables detents; get_periodic_detents() then returns false, otherwise a full configuration copy.

Example#

GML
wheel = jolt_control_wheel({periodic_detents: {count: 12, max_torque: 2}});
var held = wheel.get_periodic_detent();
if (!is_undefined(held)) {
    show_debug_message("Index: " + string(held.index));
    show_debug_message("Angle: " + string(held.angle));
}
// wheel.set_periodic_detents(false);

get_periodic_detent() returns undefined without an active capture, otherwise {index,angle}. index is the position 0..count−1 within a turn; angle is the specific logical angle in degrees including the turn. Equal distances prefer the lower absolute target angle. Native stepping selects the detent, not the getter.

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
JoltControl.get_periodic_detentJoltControl.get_periodic_detent()Wheel/Crank: config count1..3600 or false disables; same limits as AssetControlSettings. Setter Boolean, getter config / false when disabled / undefined on error. Active detent {index, angle°} or undefined.
JoltControl.get_periodic_detentsJoltControl.get_periodic_detents()Wheel/Crank: config count1..3600 or false disables; same limits as AssetControlSettings. Setter Boolean, getter config / false when disabled / undefined on error. Active detent {index, angle°} or undefined.
JoltControl.set_periodic_detentsJoltControl.set_periodic_detents(options)Wheel/Crank: config count1..3600 or false disables; same limits as AssetControlSettings. Setter Boolean, getter config / false when disabled / undefined on error. Active detent {index, angle°} or undefined.