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#
| Constant | Value |
|---|---|
| JOLT_CHARACTER_CONTACT_ADDED | 1 |
| JOLT_CHARACTER_CONTACT_PERSISTED | 2 |
| JOLT_CHARACTER_CONTACT_REMOVED | 3 |
Body contacts#
var contacts = player.get_contacts();
for (var i = 0; i < array_length(contacts); ++i) {
var hit = contacts[i];
show_debug_message(hit.entity);
}| Field | Meaning |
|---|---|
| type | Added, persisted, or removed. |
| character | This JoltCharacter. |
| body / body_handle / body_valid | Managed body and safe native identity. |
| entity | The body's user_data value. |
| sensor | Whether the body contact is a sensor. |
| position / normal / velocity | World-space contact data. |
Character-to-character contacts#
player.set_character_collision_mode(JOLT_CHARACTER_PUSH);
player.set_character_push_strength(50);
var pairs = player.get_character_contacts();| Mode | Behaviour |
|---|---|
| JOLT_CHARACTER_IGNORE | No character pair collision; the default. |
| JOLT_CHARACTER_BLOCK | Characters block without pushing one another. |
| JOLT_CHARACTER_PUSH | Blocking plus a bounded queued push velocity. |
Layer-pair policy#
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#
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#
| API | Contract |
|---|---|
| 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. |
// 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 / owner | Signature | Operation contract |
|---|---|---|
| jolt_get_dropped_character_contact_count | jolt_get_dropped_character_contact_count() | Numeric sum of dropped Character–Character events during the latest managed drain; initially 0. |
| jolt_get_character_contacts | jolt_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_mode | jolt_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_contacts | JoltCharacter.clear_contacts() | Boolean; empties the corresponding GML array and native queue. Does not remove physical collisions or change filtering. |
| JoltCharacter.clear_character_contacts | JoltCharacter.clear_character_contacts() | Boolean; empties the corresponding GML array and native queue. Does not remove physical collisions or change filtering. |
| JoltCharacter.get_contacts | JoltCharacter.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_count | JoltCharacter.get_dropped_contact_count() | Numeric count of dropped native contact events, undefined on error. Not the total number of contacts. |
| JoltCharacter.get_character_collision_mode | JoltCharacter.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_contacts | JoltCharacter.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_layer | JoltCharacter.get_character_layer() | Stored JoltLayer, not a numeric handle. Getter does not itself validate liveness. |
| JoltCharacter.get_character_push_strength | JoltCharacter.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_layer | JoltCharacter.get_layer() | Stored JoltLayer, not a numeric handle. Getter does not itself validate liveness. |
| JoltCharacter.character_contact_entered | JoltCharacter.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_exited | JoltCharacter.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_mode | JoltCharacter.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_layer | JoltCharacter.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_strength | JoltCharacter.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_layer | JoltCharacter.set_layer(layer) | Live JoltLayer in the same world; Boolean. Both update the Character stored layer; neither writes collision matrix rules. |