Paths

Creating Paths

Creates a managed Hermite path resource for sampling or physics constraints.

Calling jolt_path() without arguments creates an empty JoltPath in the managed default world. Add control points, configure whether the path loops, and call build_smooth() before sampling it or attaching a body.

Syntax#

Syntax
path = jolt_path();

Basic path#

GML
jolt_start();

var track = jolt_path();
track.add_point(-12, 0, 2);
track.add_point(0, 4, 6);
track.add_point(12, 0, 2);

if (!track.build_smooth()) {
    show_error(jolt_get_error().message, true);
}

Build lifecycle#

  • A newly created path is valid but not built.
  • Adding a point or changing loop mode discards the previous native build.
  • build_smooth() creates the native Hermite resource and cached sampling data.
  • Sampling and constraints require a built, non-dirty path from the active default world.
  • jolt_stop() invalidates every managed path resource.

State and lifetime#

GML
track.is_valid()
track.get_point_count()
track.get_length()
track.get_bounds()
track.destroy()

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_pathjolt_path(body_a = undefined, body_b = undefined, path = undefined, options = undefined)Without arguments creates a JoltPath builder. With two bodies and a built path creates a Path JoltConstraint. Result/undefined; path local to body_a. Rotation_mode defaults FREE, collision/enabledtrue, optional motor_spring_frequency/damping1.
jolt_path_worldjolt_path_world(body, path, options = undefined)Dynamic Body + currently built JoltPath; Constraint/undefined. Path coordinates are world-space, rotation_mode FREE, enabledtrue; creates no support body.
JoltPath.destroyJoltPath.destroy()is_valid Boolean, a valid unbuilt draft returns true. Destroy Boolean idempotently releases path resource and control-point list, not bodies.
JoltPath.is_validJoltPath.is_valid()is_valid Boolean, a valid unbuilt draft returns true. Destroy Boolean idempotently releases path resource and control-point list, not bodies.