Constraints

Point Constraint

Keeps one material point on each body coincident while leaving all relative rotation free.

Point is the simplest ball-and-socket style connection. It uses one shared world-space anchor at creation, stores a local attachment for each body, and does not impose angular limits or a motor.

Syntax#

Syntax
jolt_point(body_a, body_b, anchor_x, anchor_y, anchor_z, options=undefined)
jolt_point_world(body, anchor_x, anchor_y, anchor_z, options=undefined)

Arguments and options#

NameDefaultDescription
body_a / body_brequiredTwo different live managed bodies.
bodyrequiredSingle body used by the world variant.
anchor_x / anchor_y / anchor_zrequiredShared finite world-space attachment point.
collisiontrueBody-to-body only: whether the pair may collide.
enabledtrueInitial solver state.

Methods#

MethodResultPoint behaviour
is_valid()BooleanChecks the managed wrapper and its native generational handle.
get_native_handle()RealReturns the opaque native handle, or 0 when invalid.
destroy()BooleanIdempotently releases only the constraint; connected bodies remain alive.
set_enabled(enabled) / get_enabled()BooleanTemporarily removes or restores solver participation without destroying the constraint.
set_collision_enabled(enabled) / get_collision_enabled()BooleanControls collision for a body pair. World variants always report false.
get_impulse()RealMagnitude of the three-axis positional solver impulse from the latest update.

Example: pendulum#

GML
var support = jolt_box_create_static(0, 0, 6, 0.5, 0.5, 0.5);
var weight  = jolt_box_create_dynamic(0, 0, 3, 0.8, 0.8, 0.8, { mass: 4 });
var joint   = jolt_point(support, weight, 0, 0, 5.5, {
    collision: false
});

weight.add_impulse(4, 0, 0);

World variant#

GML
var ball = jolt_sphere_create_dynamic(0, 0, 3, 0.5, { mass: 2 });
var pivot = jolt_point_world(ball, 0, 0, 4);

Errors and lifecycle#

  • Body-to-body creators require two different live managed JoltBody values in the same managed default world.
  • At least one connected body must be movable; native Jolt rejects an unsupported static-static pair.
  • Constructors return a managed JoltConstraint on success or undefined after a validation/native creation failure.
  • Destroying either attached body automatically destroys and invalidates the constraint before releasing that body.
  • Read jolt_get_error() after a failed creator or method when the values may be untrusted.
  • The shared anchor must be finite.
  • Point has no limits, spring or motor methods; calling a type-incompatible JoltConstraint method records an invalid-operation error.
  • An off-centre anchor naturally lets constraint force generate torque on a body.

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_pointjolt_point(body_a, body_b, anchor_x, anchor_y, anchor_z, options = undefined)Returns JoltConstraint/undefined, does not own bodies. Two distinct live same-world bodies; _world variant one Dynamic body and fixed world. Enabled defaults true; ordinary two-body collision defaults true unless specified otherwise below. Also check jolt_has_error after creation: some subsequent options can fail while returning the created constraint. Shared world XYZ anchor m, free rotation.
jolt_point_worldjolt_point_world(body, anchor_x, anchor_y, anchor_z, options = undefined)Returns JoltConstraint/undefined, does not own bodies. Two distinct live same-world bodies; _world variant one Dynamic body and fixed world. Enabled defaults true; ordinary two-body collision defaults true unless specified otherwise below. Also check jolt_has_error after creation: some subsequent options can fail while returning the created constraint. Shared world XYZ anchor m, free rotation.