Constraints

Constraint Limits

Defines the legal positional or angular range independently for each supported constraint family.

Limit units and valid ranges are type-specific. Do not treat every JoltConstraint as if it accepted the same set_limits() signature.

Limit API by type#

TypeCreation fieldsRuntime methodsUnits and validation
Hingelimits_min / limits_maxset_limits(min,max), get_limits()Degrees; finite and ordered.
Sliderlimits_min / limits_maxset_limits(min,max), get_limits()World units; minimum <= 0 <= maximum.
Distancemin_distance / max_distanceset_limits(min,max), get_limits()World units; 0 <= minimum <= maximum.
Conemax_angleset_limit(angle), get_limit()Single swing half-angle, 0..180 degrees.
SwingTwistnormal/plane half-angles, twist_min/maxset_limits(n,p,tmin,tmax), set_swing_limits(), set_twist_limits(), get_limits()Degrees; swing 0..180, twist within -180..180 and ordered.
SixDOFsix axis fieldsset_axis_limit(), set_translation_limits(), set_rotation_limits()Linear world units; angular degrees within -180..180.
Pulleymin_length / max_lengthset_length(min,max), length gettersCreation accepts -1 auto-resolution; runtime requires 0 <= min <= max.

Fixed, free and limited#

  • Equal Distance or Pulley bounds create an exact length.
  • Slider zero is the relative creation pose, so the legal range must contain zero.
  • Hinge -180..180 is effectively free rotation around its axis; equal limits lock the selected relative angle.
  • SwingTwist 0-degree half-angles lock swing dimensions; 180 degrees is effectively free.
  • SixDOF represents each axis explicitly as FIXED, FREE or LIMITED rather than inferring state from a numeric range.

SixDOF swing warning#

Rotation X is twist. Rotation Y/Z are coupled swing dimensions. CONE requires symmetric Y/Z limited ranges around zero, while PYRAMID permits asymmetric ranges. They are not independent Euler clamps.

Runtime example#

GML
hinge.set_limits(0, 110);          // degrees
slider.set_limits(-1.5, 1.5);     // world units, contains zero
tether.set_limits(2, 4);          // non-negative distance
cone.set_limit(35);                // degrees
swing.set_twist_limits(-25, 25);  // degrees
pulley.set_length(6, 8);           // combined segment length

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
JoltConstraint.get_limitJoltConstraint.get_limit()Cone only: half-angle 0..180°; setter Boolean, getter number in degrees or 0 on error.
JoltConstraint.get_limitsJoltConstraint.get_limits(){minimum, maximum} for Hinge (°), Distance/Slider (m); SwingTwist {normal_half_angle, plane_half_angle, twist_min, twist_max} (°). undefined for invalid/unsupported constraint or error.
JoltConstraint.get_rotation_limits_maxJoltConstraint.get_rotation_limits_max()SixDOF {x, y, z}, translation in m / rotation in °. Composes individual getters; error components can be 0.
JoltConstraint.get_rotation_limits_minJoltConstraint.get_rotation_limits_min()SixDOF {x, y, z}, translation in m / rotation in °. Composes individual getters; error components can be 0.
JoltConstraint.get_translation_limits_maxJoltConstraint.get_translation_limits_max()SixDOF {x, y, z}, translation in m / rotation in °. Composes individual getters; error components can be 0.
JoltConstraint.get_translation_limits_minJoltConstraint.get_translation_limits_min()SixDOF {x, y, z}, translation in m / rotation in °. Composes individual getters; error components can be 0.
JoltConstraint.set_limitJoltConstraint.set_limit(angle)Cone only: half-angle 0..180°; setter Boolean, getter number in degrees or 0 on error.
JoltConstraint.set_limitsJoltConstraint.set_limits(minimum, maximum, twist_min = undefined, twist_max = undefined)Boolean. Hinge: -180 ≤ min ≤ 0 ≤ max ≤ 180 degrees. Distance: 0 ≤ min ≤ max m. Slider: min ≤ 0 ≤ max m. SwingTwist: all 4 arguments required, normal/plane half-angles 0..180°, -180 ≤ twist_min ≤ twist_max ≤ 180°. Finite values; other joint types rejected.
JoltConstraint.set_rotation_limitsJoltConstraint.set_rotation_limits(min_x,min_y,min_z,max_x,max_y,max_z)SixDOF: three min/max pairs, m or ° according to the name. Boolean; calls three set_axis_limit operations sequentially, not atomically — earlier axes may change before a later axis fails.
JoltConstraint.set_translation_limitsJoltConstraint.set_translation_limits(min_x,min_y,min_z,max_x,max_y,max_z)SixDOF: three min/max pairs, m or ° according to the name. Boolean; calls three set_axis_limit operations sequentially, not atomically — earlier axes may change before a later axis fails.