StairsSteppingBody3D
by vissa
8
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. - Don't call
move_and_slide()
in your character controller, as the class calls it on it's own when calculating stair stepping.
Credits
Most of the code in this addon has been forked from other projects. Check out full list for more:
- Special thanks to Majikayo Games
for original solution to stair_step_down! - Special thanks to Myria666
for paper on Quake movement mechanics
(used for stair_step_up)! - Special thanks to Andicraft
for help with implementation of stair_step_up! - Special thanks to JheKWall for
original character controller demo
this is based on! - Vissa refactored previous code
so that it could be used with Entity Component System or with Node Inheritance
Notes:
-
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. -
To adjust the step-up/down height, just change the
MAX_STEP_UP
/MAX_STEP_DOWN
. -
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.
- Small gaps that you should be able to fit through both ways will block you in Godot Physics.
TLDR: This still works with default Godot Physics, although it feels a lot better in Jolt Physics.
Download
Version1.0.2
Download Now
Support
If you need help or have questions about this plugin, please contact the author.
Contact Author