Debug

Raycasts

Keeps and displays the most recent ray queries issued while raycast debugging is enabled.

Both managed endpoint raycasts and low-level origin/direction raycasts record a compact debug struct only when global debug and JOLT_DEBUG_RAYCASTS are already enabled.

Enable before casting#

GML
jolt_debug_enable(true);
jolt_debug_set(JOLT_DEBUG_RAYCASTS, true);

var hit = jolt_raycast(x, y, z, target_x, target_y, target_z);
jolt_debug_draw();

Visual meaning#

ElementMeaning
Green segmentRay hit; the segment stops at the closest reported hit.
Orange segmentRay missed; the segment reaches its requested target or maximum distance.
Green crossHit position.
Cyan-green lineHit normal extending 0.6 world units.

History#

  • The renderer retains at most 32 recent raycast debug records.
  • When a 33rd record is added, the oldest is removed.
  • jolt_debug_clear_raycasts() clears the history manually.
  • jolt_stop() also clears all retained raycasts and releases the renderer.

Multiple hits#

jolt_raycast_all() stores one visual record. When hits exist it uses the first, closest sorted result; the retained line therefore stops at that closest body rather than drawing every result.