Skip to content

Extension for CharacterBody3D that is able to go up and down the stairs

License

Notifications You must be signed in to change notification settings

Visssarion/Stairs-Stepping-Body

Repository files navigation

StairsSteppingBody3D

CharacterBody3D that automatically controlls movement up and down the stairs

How to use

  • Set PLAYER_COLLIDER to whichever collider you want your body to use.
  • Set velocity every physical frame to whatever value you wish to move;
  • Don't forget to call super(delta) at the start of _physics_process if you are overriding it.

Credits

Most of the code in this addon has been forked from other projects. Check out full list for more:

Notes:

  1. All shape colliders are supported. But Capsule colliders are recommended for enemies due to its compatibility with the Navigation Meshes. Its up to you what shape you want to use for players.

  2. To adjust the step-up/down height, just change the MAX_STEP_UP/MAX_STEP_DOWN.

  3. This uses Jolt Physics as the default Godot Physics has a few bugs:

    • Small gaps that you should be able to fit through both ways will block you in Godot Physics. You can see this demonstrated with the floating boxes in front of the big stairs.
    • Walking into some objects may push the player downward by a small amount which causes jittering and causes the floor to be detected as a step.

TLDR: This still works with default Godot Physics, although it feels a lot better in Jolt Physics.

About

Extension for CharacterBody3D that is able to go up and down the stairs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published