DinkeyKing / Improved-KCC

Custom kinematic character controller with step functionality, for Godot.
MIT License
16 stars 2 forks source link

Make capsule colliders climb stairs #3

Closed DinkeyKing closed 1 week ago

DinkeyKing commented 2 weeks ago

The function for step detection doesn't work for capsule (or sphere) colliders. The downard cast on ledges won't return floor collision normals because of the rounded bottom of the collider shape, which is the expected behaviour. Checking surface normals could be a solution, but currently the function raycasting the collision points does not hit the floor surface in this scenario for some reason.

DinkeyKing commented 1 week ago

Progress in 0ec3554. Capsule colliders now detect the floor surface of steps that are not too shallow, but short steps prove to be a problem, due to the height of the collision point still being higher than the maximum allowd height, for some odd reason.

DinkeyKing commented 1 week ago

I finally figured out that the shape radius has to be added on top of the max allowed height, which makes stepping work properly for capsules and spheres. Snapping down stairs now also work. 4b88e76