Shape Queries
Query Results
Reference and usage: Query Results.
| API | Contract |
|---|---|
| body / body_handle / body_valid / entity | Managed body if resolvable, opaque native identity, resolution validity and associated user entity. Never assume body exists. |
| position | Contact on the TARGET surface in world space. |
| query_position | Contact on the QUERY surface; not the centre to place a body at. |
| shape_position | Query origin at the hit fraction. |
| normal / penetration_depth | Normal points from target towards query; depth describes penetration. |
| fraction / distance / initial_overlap | Cast progress, travelled distance and initial-penetration flag. |
| query_sub_shape_id / target_sub_shape_id | Opaque sub-shape identifiers, not GML array indices. |
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());
}
}