‹›
Utility Scripts · Body Penetration

Relationships and Snapshots

Read actual depth, state and geometry for one Tip–target connection.

JoltPenetrationRelationship is created automatically and has no public method for forced capture or termination. Remove the owning Tip or destroy the relevant body to end it explicitly. A snapshot is a copy at the time of reading; editing it does not control the solver.

MethodMeaning
rel.is_valid()Bool: the relationship still exists in the current world.
rel.get_depth()Real in metres, max(0, signed_depth). Check validity before reading.
rel.get_snapshot()Struct or undefined; GML resolves a target wrapper from target_handle.
GML
var rel = tip.get_relationship();
if (is_struct(rel) && rel.is_valid()) {
    var snapshot = rel.get_snapshot();
    if (is_struct(snapshot) && snapshot.has_entered) {
        show_debug_message("Depth: " + string(snapshot.depth) + " m");
        show_debug_message("Progress: " + string(snapshot.depth_percent) + "%");
    }
}

Snapshot fields#

FieldsType / unitsMeaning
schema1Data-structure version.
handle / tip_handle / penetrator_handle / target_handleHandlesIdentities of the relationship, Tip and both bodies.
targetJoltBody / undefinedManaged target wrapper added by get_snapshot(). Not added to native event snapshots.
state / phaseIntegerPublic JoltPenetrationState and low-level phase: 1 Engaging, 2 Engaged, 3 Releasing. Do not mix these enums.
has_enteredBoolThe relationship has reached actual entry. It does not revert to false during later extraction.
signed_depth / depth / max_depthmDepth along the axis from entry; signed_depth may be negative and depth is nonnegative. max_depth is the effective limit.
depth_percent% / 0–100Depth relative to the limit, clamped to 0–100. Inspect signed_depth rather than this percentage for overshoot.
axial_speedm/sRelative Tip speed: positive inward, negative outward.
tip_position / entry / axis{x,y,z}Current world-space Tip point, entry point and normalized channel axis. The frame moves with a Dynamic target.
lateral_errormTip displacement away from the channel axis.
angle_errorradDeviation from the captured relative orientation; not the impact angle in degrees.
embedded / at_limitBoolDerived resting state inside material / reaching the depth-limit region.
suppressed / clearanceBoolOwned pair-collision suppression / geometric clearance result.
forward_force / backward_forceNResistance captured for this relationship.
motor_lambda / limit_lambda / sample_validSolver sampleImpulse quantities of the last solver sample and its validity. They are not automatically forces in N and may be invalid while sleeping.
capture_source0–40 original, 1 query, 2 contact-assisted, 3 support with current intent, 4 support with earlier valid evidence.
step_serial / revisionIntegerSimulation step and snapshot revision. Model 2 can produce multiple revisions within one outer step.

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
JoltPenetrationRelationship.get_depthJoltPenetrationRelationship.get_depth()Nonnegative depth in m; native failure can yield 0, check is_valid and error.
JoltPenetrationRelationship.get_snapshotJoltPenetrationRelationship.get_snapshot()Detached schema snapshot with managed target added, or undefined. The relationship does not own the target body.
JoltPenetrationRelationship.is_validJoltPenetrationRelationship.is_valid()Boolean relationship existence in the current world.