‹›
Character

Ground Detection

Reads the CharacterVirtual support state, surface data, and landing transitions.

The controller updates its ground support every native step. Read the state after jolt_update() so it describes the latest completed simulation.

Ground states#

ConstantValueMeaning
JOLT_CHARACTER_GROUND_ON_GROUND0Supported by a walkable surface.
JOLT_CHARACTER_GROUND_ON_STEEP1Touching support that exceeds max_slope.
JOLT_CHARACTER_GROUND_NOT_SUPPORTED2Contact exists, but it does not currently support the character.
JOLT_CHARACTER_GROUND_IN_AIR3No supporting contact.

State checks#

GML
var state = player.get_ground_state();
if (player.is_grounded()) {
    // On a walkable surface.
} else if (player.is_on_steep_ground()) {
    // Touching a slope that cannot be climbed.
} else if (player.is_in_air()) {
    // Fully airborne.
}

Surface information#

GML
var normal = player.get_ground_normal();
var point = player.get_ground_position();
var velocity = player.get_ground_velocity();
var body = player.get_ground_body();
var entity = player.get_ground_entity();
MethodResult
get_ground_normal()Supporting surface normal.
get_ground_position()World-space contact position.
get_ground_velocity()Velocity of the supporting surface at the contact.
get_ground_body()Managed JoltBody or undefined when unavailable.
get_ground_entity()That body's user_data, commonly a bound instance.

Transition events#

GML
if (player.just_landed()) {
    effect_create_above(ef_smoke, x, y, 0, c_white);
}

if (player.just_left_ground()) {
    // Start falling animation.
}

Both flags cover the complete jolt_update() call, even when it performs multiple fixed steps.

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
JoltCharacter.get_ground_bodyJoltCharacter.get_ground_body()Managed support JoltBody or its user_data; undefined if no matching live wrapper or on error.
JoltCharacter.get_ground_entityJoltCharacter.get_ground_entity()Managed support JoltBody or its user_data; undefined if no matching live wrapper or on error.
JoltCharacter.get_ground_normalJoltCharacter.get_ground_normal()Support normal: world {x, y, z}, jednotkový vektor / unit vector; undefined on error. Read support data together with ground_state.
JoltCharacter.get_ground_positionJoltCharacter.get_ground_position()Support position: world {x, y, z}, m; undefined on error. Read support data together with ground_state.
JoltCharacter.get_ground_stateJoltCharacter.get_ground_state()JOLT_CHARACTER_GROUND_* enum, undefined on error; latest solver state.
JoltCharacter.get_ground_velocityJoltCharacter.get_ground_velocity()Support velocity: world {x, y, z}, m/s; undefined on error. Read support data together with ground_state.
JoltCharacter.is_groundedJoltCharacter.is_grounded()Boolean derived from ground_state; is_in_air includes IN_AIR and NOT_SUPPORTED. A read error yields false, not proof of ground support.
JoltCharacter.is_in_airJoltCharacter.is_in_air()Boolean derived from ground_state; is_in_air includes IN_AIR and NOT_SUPPORTED. A read error yields false, not proof of ground support.
JoltCharacter.is_on_steep_groundJoltCharacter.is_on_steep_ground()Boolean derived from ground_state; is_in_air includes IN_AIR and NOT_SUPPORTED. A read error yields false, not proof of ground support.
JoltCharacter.just_landedJoltCharacter.just_landed()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.just_left_groundJoltCharacter.just_left_ground()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).