‹›
Character

Character Contacts

Consumes rigid-body and character-to-character contact events generated by the managed controller.

The native bridge records Added, Persisted, and Removed events. jolt_update() drains them into fresh world and per-character arrays after all fixed steps have completed.

Event types#

Body contacts#

GML
var contacts = player.get_contacts();
for (var i = 0; i < array_length(contacts); ++i) {
    var hit = contacts[i];
    show_debug_message(hit.entity);
}
FieldMeaning
typeAdded, persisted, or removed.
characterThis JoltCharacter.
body / body_handle / body_validManaged body and safe native identity.
entityThe body's user_data value.
sensorWhether the body contact is a sensor.
position / normal / velocityWorld-space contact data.

Character-to-character contacts#

GML
player.set_character_collision_mode(JOLT_CHARACTER_PUSH);
player.set_character_push_strength(50);

var pairs = player.get_character_contacts();
ModeBehaviour
JOLT_CHARACTER_IGNORENo character pair collision; the default.
JOLT_CHARACTER_BLOCKCharacters block without pushing one another.
JOLT_CHARACTER_PUSHBlocking plus a bounded queued push velocity.

Layer-pair policy#

GML
jolt_character_layers_set_mode(player_layer, enemy_layer, JOLT_CHARACTER_BLOCK);

The per-character modes and the symmetric layer-pair rule are resolved together. Both layers must belong to the same live world. Character collision processing is a serial brute-force list in the current implementation.

Transient pair events#

GML
player.character_contact_entered()
player.character_contact_exited()
player.clear_contacts()
player.clear_character_contacts()
player.get_dropped_contact_count()

The managed arrays are replaced by the next jolt_update(). Copy any event data you need to retain.

Layers, readback and world diagnostics#

APIContract
set_character_layer(layer) / get_character_layer()Uses a live same-world JoltLayer; shares the wrapper's current layer value with set_layer/get_layer.
get_character_collision_mode()Reads IGNORE, BLOCK or PUSH; do not infer it from max push force.
set_character_push_strength(value) / get_character_push_strength()Finite nonnegative character-pair push setting; distinct from max_strength against rigid bodies.
jolt_get_character_contacts()Latest managed world-level character-pair event array after jolt_update().
jolt_get_dropped_character_contact_count()Dropped character-pair event count exposed by the managed drain; inspect to detect overflow.
GML
// Read after the central physics update.
var pairs = jolt_get_character_contacts();
var dropped = jolt_get_dropped_character_contact_count();
if (dropped > 0) show_debug_message("Character contact overflow: " + string(dropped));

The global pair array is not the per-character rigid-body contact array from player.get_contacts(). Treat event arrays as update snapshots and process them before the next update replaces them.

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_get_dropped_character_contact_countjolt_get_dropped_character_contact_count()Numeric sum of dropped Character–Character events during the latest managed drain; initially 0.
jolt_get_character_contactsjolt_get_character_contacts()Global managed Character–Body event array from the jolt_update drain phase, not a Character–Character array. Format matches Character.get_contacts.
jolt_character_layers_set_modejolt_character_layers_set_mode(layer_a, layer_b, mode)Two live JoltLayer objects in the same world, IGNORE/BLOCK/PUSH mode. Boolean; sets a Character-pair rule, not the ordinary rigid collision matrix.
JoltCharacter.clear_contactsJoltCharacter.clear_contacts()Boolean; empties the corresponding GML array and native queue. Does not remove physical collisions or change filtering.
JoltCharacter.clear_character_contactsJoltCharacter.clear_character_contacts()Boolean; empties the corresponding GML array and native queue. Does not remove physical collisions or change filtering.
JoltCharacter.get_contactsJoltCharacter.get_contacts()Contact-event array: type, character, body, body_handle, body_valid, entity, sensor, position {x, y, z} m, normal, velocity {x, y, z} m/s. Read after jolt_update; sensors have separate enter/exit arrays. Not a persistent overlap list.
JoltCharacter.get_dropped_contact_countJoltCharacter.get_dropped_contact_count()Numeric count of dropped native contact events, undefined on error. Not the total number of contacts.
JoltCharacter.get_character_collision_modeJoltCharacter.get_character_collision_mode()JOLT_CHARACTER_IGNORE/BLOCK/PUSH mode between characters. Setter Boolean, getter enum or undefined on error. An explicit layer-pair rule can override the pair.
JoltCharacter.get_character_contactsJoltCharacter.get_character_contacts()Character–Character event array: type, character, other_character, other_handle, other_valid, other_entity, position, normal, relative_velocity. World m/m/s; read after jolt_update.
JoltCharacter.get_character_layerJoltCharacter.get_character_layer()Stored JoltLayer, not a numeric handle. Getter does not itself validate liveness.
JoltCharacter.get_character_push_strengthJoltCharacter.get_character_push_strength()Force against another Character: current numeric value in N. Failure: undefined; an invalid object is not a zero measurement.
JoltCharacter.get_layerJoltCharacter.get_layer()Stored JoltLayer, not a numeric handle. Getter does not itself validate liveness.
JoltCharacter.character_contact_enteredJoltCharacter.character_contact_entered()Boolean event for the managed frame; read after jolt_update. The next managed frame begin clears it. Not persistent state (e.g. just_landed is not is_grounded).
JoltCharacter.character_contact_exitedJoltCharacter.character_contact_exited()Boolean event for the managed frame; read after jolt_update. The next managed frame begin clears it. Not persistent state (e.g. just_landed is not is_grounded).
JoltCharacter.set_character_collision_modeJoltCharacter.set_character_collision_mode(mode)JOLT_CHARACTER_IGNORE/BLOCK/PUSH mode between characters. Setter Boolean, getter enum or undefined on error. An explicit layer-pair rule can override the pair.
JoltCharacter.set_character_layerJoltCharacter.set_character_layer(layer)Live JoltLayer in the same world; Boolean. Both update the Character stored layer; neither writes collision matrix rules.
JoltCharacter.set_character_push_strengthJoltCharacter.set_character_push_strength(value)Force against another Character: finite number ≥0 N; default 50. Returns true on acceptance, false for an invalid input or object. Updates the live object.
JoltCharacter.set_layerJoltCharacter.set_layer(layer)Live JoltLayer in the same world; Boolean. Both update the Character stored layer; neither writes collision matrix rules.