Character
Slopes & Stairs
Configures walkable slope angles, steep-slope rejection, and automatic stair traversal.
Character movement is projected away from surfaces that are too steep. ExtendedUpdate also attempts to step up and remain attached to walkable floors.
Configuration#
player.set_max_slope(45);
player.set_step_height(0.35);
var angle = player.get_max_slope();
var step = player.get_step_height();| Setting | Valid range | Effect |
|---|---|---|
| max_slope | Greater than 0 and less than 90 degrees | Maximum surface angle treated as walkable. |
| step_height | 0 through standing height | Distance used for automatic step-up and additional step-down. |
Native stair behaviour#
- Step-up uses the current up vector multiplied by step_height.
- Floor sticking steps down by at least 0.5 world units, or step_height when larger.
- An additional stair step-down uses exactly step_height.
- Desired movement into an overly steep slope is cancelled before the update.
Detecting a steep surface#
if (player.is_on_steep_ground()) {
var normal = player.get_ground_normal();
// Play a slide animation or reduce player input.
}Runtime tuning#
Both settings take effect on the next fixed character step. Keep max_slope and level geometry consistent so stairs do not alternate between walkable and steep contacts at edges.
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 |
|---|---|---|
| JoltCharacter.get_max_slope | JoltCharacter.get_max_slope() | Maximum walkable slope: current numeric value in °. Failure: undefined; an invalid object is not a zero measurement. |
| JoltCharacter.get_step_height | JoltCharacter.get_step_height() | Step height: current numeric value in m. Failure: undefined; an invalid object is not a zero measurement. |
| JoltCharacter.set_max_slope | JoltCharacter.set_max_slope(degrees) | Maximum walkable slope: finite number (0, 90) °; default 45. Returns true on acceptance, false for an invalid input or object. Updates the live object. |
| JoltCharacter.set_step_height | JoltCharacter.set_step_height(value) | Step height: finite number 0..standing_height m; default .35. Returns true on acceptance, false for an invalid input or object. Updates the live object. |