Debug

Debug Draw

Renders optional physics diagnostics with the current GameMaker 3D camera.

The built-in debug renderer is separate from simulation. It reads managed state and native snapshots only when asked to draw, owns no camera, and leaves the active view and projection matrices unchanged.

Basic setup#

GML
// Create event
jolt_debug_enable(true);
jolt_debug_set(JOLT_DEBUG_ALL, false);
jolt_debug_set(JOLT_DEBUG_SHAPES | JOLT_DEBUG_CONTACTS, true);

// Draw End event, after opaque 3D models
jolt_debug_draw();

Public controls#

FunctionResult
jolt_debug_enable(enabled)Globally enables or disables recording and drawing.
jolt_debug_is_enabled()Returns the global enabled state.
jolt_debug_set(flags, enabled)Adds or removes bits and returns the resulting mask.
jolt_debug_get_flags()Returns the stored category mask.
jolt_debug_draw(flags=undefined)Draws the supplied mask or the stored flags; returns false when disabled or physics is stopped.

Debug flags#

Render-state behaviour#

  • Uses the current matrix_view and matrix_projection and never creates or changes the game camera.
  • Enables depth testing with cmpfunc_lessequal and disables depth writes for diagnostic lines.
  • Uses no back-face culling or blending during the pass.
  • Restores the previous GPU state, world matrix, and active shader before returning.
  • Reusable primitive line meshes are created lazily and released by jolt_stop().

Temporary mask override#

GML
// Draw only constraints this frame without changing stored flags.
jolt_debug_draw(JOLT_DEBUG_CONSTRAINTS);

Current project integrations#

Additional current diagnostics#

JOLT_DEBUG_ALL currently equals 262143 and includes Ragdolls. Flags cover Shapes, Contacts, Sensors, Raycasts, Constraints, Characters, Cloth, Center of Mass, Shape Queries, Vehicles, Grabber, Sockets, Penetration, Explosions, Forces, Points, Surfaces and Ragdolls. Physical Controls use related mechanism drawing, not an invented JOLT_DEBUG_CONTROLS flag.

Convex shapes draw their actual hull shell rather than only an AABB. jolt_debug_set_penetration_history enables records under JOLT_DEBUG_PENETRATION. Ragdoll options: shapes, links, anchors, axes, swing_limits, twist_limits, current_pose, centers, xray, scale; scale ranges from 0.1 to 4. An unknown setter option returns false; the getter returns undefined.

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_debug_drawjolt_debug_draw(flags = undefined)Draw with active3D camera, optional flags for this draw(otherwise stored mask). Boolean; false when disabled/world stopped/failure. Restores GPU state, also includes locally enabled soft debug.
jolt_debug_enablejolt_debug_enable(enabled)Drawing enable:setter converts enabled==true and returns true, getter Boolean. Changes neither physics nor individual flags.
jolt_debug_get_flagsjolt_debug_get_flags()Set(flags, true) adds bits, false removes; set(0) clears all. set(nonzero) alone does not replace the entire mask, it removes those bits. Returns resulting mask; get current mask.
jolt_debug_get_ragdolljolt_debug_get_ragdoll(option)Keys shapes, links, anchors, axes, swing_limits, twist_limits, current_pose, centers, xray Boolean; scale finite.1..4. Setter Boolean, getter value/undefined for unknown key. Appearance only.
jolt_debug_is_enabledjolt_debug_is_enabled()Drawing enable:setter converts enabled==true and returns true, getter Boolean. Changes neither physics nor individual flags.
jolt_debug_setjolt_debug_set(flags, enabled=undefined)Set(flags, true) adds bits, false removes; set(0) clears all. set(nonzero) alone does not replace the entire mask, it removes those bits. Returns resulting mask; get current mask.
jolt_debug_set_ragdolljolt_debug_set_ragdoll(option,value)Keys shapes, links, anchors, axes, swing_limits, twist_limits, current_pose, centers, xray Boolean; scale finite.1..4. Setter Boolean, getter value/undefined for unknown key. Appearance only.

Complete API declarations#

Declarations match the production GML sources. A value after = marks an optional argument. This is a signature inventory; the guide sections describe meaning, units and limitations. The type before a dot identifies the method owner, not a global function.