Utility Scripts · Body Penetration

Tip API Reference

Public JoltPenetrator setters and diagnostic methods, including activation and configuration behavior.

Obtain a Tip with jolt_penetrator_tip(body, config). Store the returned object, check is_struct and later use is_valid(). Its native handle is not a GameMaker instance ID; different tips on the same body have separate identities.

MethodReturnsContract
tip.is_valid()BoolThe prepared or registered Tip has a valid owner in the current world. True alone does not mean activation. Destroying the body or world invalidates it.
tip.set_enabled(enabled)BoolFirst validates and activates a prepared Tip; later enables or disables new admission. Existing relationships remain until extraction or removal; other Tips are unaffected.
tip.configure(config)BoolMerges known supplied fields into the current configuration. Returns false for invalid config or Busy during engagement/rearm. Cannot change the owning body.
tip.remove()BoolExplicitly removes the Tip, ends its relationships and releases its collision leases. Does not destroy its body. Repeated calls on a removed wrapper succeed.
tip.get_reject_reason()Real / integer codeThe latest diagnostic reject. Not a history of every candidate or a relationship state.
tip.get_info()Struct / undefinedCurrent configuration, state, reject and an array of relationship handles. A snapshot is unavailable for an invalid world/handle.
tip.get_relationship()JoltPenetrationRelationship / undefinedThe first current relationship. With multiple targets it is not necessarily the deepest or most recent hit.
tip.get_relationships()ArrayAll current relationship wrappers; returns [] when none exist. Surviving wrappers retain their identity.

Before activation, is_valid() describes a valid prepared object; get_info() reports handle=0, enabled=false and empty relationships. The first set_enabled(true) validates the tip on the surface. On failure, fix the settings and retry. After registration, setters apply immediately and respect Busy while engaged/rearming.

GML
tip.set_local_position(x, y, z);
tip.set_local_axis(x, y, z);
tip.set_max_angle(degrees);
tip.set_max_insertion(metres);
tip.set_max_simultaneous_penetrations(count);
tip.set_max_capture_axial_speed(speed);
tip.set_mask(bits);
tip.set_capture_model(model);
tip.set_probe_length(metres);
tip.set_probe_radius(metres);
tip.set_capture_gap(metres);
tip.set_capture_overlap(metres);
tip.set_tip_surface_tolerance(metres);
tip.set_rearm_separation(metres);
tip.set_contact_assisted(enabled);
tip.set_contact_tolerance(metres);
tip.set_enabled(true);

Changing and reading safely#

GML
if (is_struct(tip) && tip.is_valid()) {
    if (!tip.set_max_angle(35)) {
        show_debug_message(jolt_get_error_message());
    }
    var info = tip.get_info();
    if (is_struct(info)) {
        show_debug_message("Model: " + string(info.capture_model));
        show_debug_message("Relationships: " + string(array_length(info.relationships)));
    }
}

get_info() fields#

The struct contains schema=1, handle, body_handle, enabled, state, reject_reason, relationships and all current configuration fields: mask, local_position, local_axis, max_angle, contact_tolerance, max_insertion, max_simultaneous_penetrations, max_capture_axial_speed, capture_model, contact_assisted, probe_length, probe_radius, capture_gap, capture_overlap, tip_surface_tolerance and rearm_separation. relationships contains numeric handles; use get_relationships() for objects.

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
JoltPenetrator.configureJoltPenetrator.configure(config)Partial config struct → Boolean. Rejects unknown/invalid fields, copies local vectors. A live engaged/rearming tip can reject changes as busy; does not destroy a physical relationship merely to change settings.
JoltPenetrator.get_infoJoltPenetrator.get_info()Configuration/state snapshot with schema:1; pending tip has handle:0, relationships:[], Idle. undefined on failure.
JoltPenetrator.get_reject_reasonJoltPenetrator.get_reject_reason()Numeric native rejection reason; valid pending tip 0, invalid pending tip 18. Not a success Boolean.
JoltPenetrator.get_relationshipJoltPenetrator.get_relationship()Current live relationship wrappers / first one. No relationship returns [] / undefined. Not completed history; read that from Body.
JoltPenetrator.get_relationshipsJoltPenetrator.get_relationships()Current live relationship wrappers / first one. No relationship returns [] / undefined. Not completed history; read that from Body.
JoltPenetrator.is_validJoltPenetrator.is_valid()Boolean; a valid pending builder can have handle 0. Destroyed host/world or removed tip is invalid.
JoltPenetrator.removeJoltPenetrator.remove()Boolean; removes tip, ends its relationships and restores temporary collision leases. Does not destroy host. Pending tip is simply marked removed.
JoltPenetrator.set_capture_gapJoltPenetrator.set_capture_gap(value)Boolean setter through configure; respects busy state. (0, 0.005] m, default 0.001.
JoltPenetrator.set_capture_modelJoltPenetrator.set_capture_model(value)Boolean setter through configure; respects busy state. 0/1/2/3; Strict Predictive = 3, configure before activation.
JoltPenetrator.set_capture_overlapJoltPenetrator.set_capture_overlap(value)Boolean setter through configure; respects busy state. (0, 0.03] m, default 0.02.
JoltPenetrator.set_contact_assistedJoltPenetrator.set_contact_assisted(value)Boolean setter through configure; respects busy state. Boolean/0/1, default true. Effect depends on selected capture model.
JoltPenetrator.set_contact_toleranceJoltPenetrator.set_contact_tolerance(value)Boolean setter through configure; respects busy state. Legacy tolerance (0, 0.1] m, default 0.02; direct options can use it as probe/rearm fallback, explicit new fields take precedence.
JoltPenetrator.set_enabledJoltPenetrator.set_enabled(enabled)Boolean/0/1 input, Boolean result. First true validates surface/axis together and registers; failure preserves edited config. False stops new admissions, does not remove existing channels.
JoltPenetrator.set_local_axisJoltPenetrator.set_local_axis(x,y,z)Boolean setter through configure; respects busy state. Local insertion direction, finite vector length 1e-5..1e19; native normalizes.
JoltPenetrator.set_local_positionJoltPenetrator.set_local_position(x,y,z)Boolean setter through configure; respects busy state. Body-origin local XYZ point, finite m.
JoltPenetrator.set_maskJoltPenetrator.set_mask(value)Boolean setter through configure; respects busy state. Integer uint32, default 4294967295; matches target category_bits, not a collision layer.
JoltPenetrator.set_max_angleJoltPenetrator.set_max_angle(value)Boolean setter through configure; respects busy state. 0 <= angle <90°, default 20.
JoltPenetrator.set_max_capture_axial_speedJoltPenetrator.set_max_capture_axial_speed(value)Boolean setter through configure; respects busy state. >=0 m/s, default 0 (no configured limit).
JoltPenetrator.set_max_insertionJoltPenetrator.set_max_insertion(value)Boolean setter through configure; respects busy state. Positive length m, default 0.5.
JoltPenetrator.set_max_simultaneous_penetrationsJoltPenetrator.set_max_simultaneous_penetrations(value)Boolean setter through configure; respects busy state. Integer 1..32, default 1.
JoltPenetrator.set_probe_lengthJoltPenetrator.set_probe_length(value)Boolean setter through configure; respects busy state. (0, 1] m, builder default 0.05.
JoltPenetrator.set_probe_radiusJoltPenetrator.set_probe_radius(value)Boolean setter through configure; respects busy state. [0, 0.1] m, default 0.
JoltPenetrator.set_rearm_separationJoltPenetrator.set_rearm_separation(value)Boolean setter through configure; respects busy state. (0, 1] m, builder default 0.01.
JoltPenetrator.set_tip_surface_toleranceJoltPenetrator.set_tip_surface_tolerance(value)Boolean setter through configure; respects busy state. (0, 0.002] m, default 0.001; actual surface tolerance, not a replacement for correct geometry.