Shape Queries

Query Results

Reference and usage: Query Results.

APIContract
body / body_handle / body_valid / entityManaged body if resolvable, opaque native identity, resolution validity and associated user entity. Never assume body exists.
positionContact on the TARGET surface in world space.
query_positionContact on the QUERY surface; not the centre to place a body at.
shape_positionQuery origin at the hit fraction.
normal / penetration_depthNormal points from target towards query; depth describes penetration.
fraction / distance / initial_overlapCast progress, travelled distance and initial-penetration flag.
query_sub_shape_id / target_sub_shape_idOpaque sub-shape identifiers, not GML array indices.
GML
var r = jolt_cast_box(0, 0, 4, 0, 0, 0, 1, 1, 1);
if (r.error_code == 0 && r.hit) {
    if (r.initial_overlap) show_debug_message("Resolve penetration first");
    else show_debug_message(r.shape_position);
    if (r.body_valid && !is_undefined(r.body)) {
        show_debug_message(r.body.get_position());
    }
}