Skip to content

five-on-it / packages/sim/src/character / slideAlongObstacles

Function: slideAlongObstacles() ​

slideAlongObstacles(sim, eid, body, v): void

Defined in: packages/sim/src/character.ts:1541

Removes from a horizontal velocity whatever would push the capsule into a wall or a car within this tick, so the character slides along it and never penetrates. The capsule is cast from a little behind itself (so the cast approaches the obstacle from outside and reports a true surface normal, which points from the capsule into the obstacle) and a little above the floor (so the floor is not a hit). Floors and slopes, with upright normals, are left alone: the solver walks the capsule up them, which is how stairs work.

Parameters ​

sim ​

SimWorld

eid ​

number

body ​

RigidBody

v ​

x ​

number

z ​

number

Returns ​

void