Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Character Step

An asset by Panthera
The page banner background of a mountain and forest
Character Step thumbnail image
Character Step thumbnail image
Character Step image holder but it is empty

Quick Information

0 ratings
Character Step icon image
Panthera
Character Step

This static class helps CharacterBody3D objects ascend and descend ledges such as stairs or obstacles.PhysicsServer3D.body_test_motion() is used to project the character as if they were moving up the ledge to test for collision. Then either a clear position is returned or the CharacterBody3D’s original position, where the body was before the projection, is returned to indicate the ledge can not be ascended or descended.This is a demo level that also includes a bare bones third person controller that shows how to use the script. If you are just after the main script head here:https://github.com/PantheraDigital/GodotCharacterStep/blob/main/scripts/character_step.gdPlay the demo:https://pantheraonline.itch.io/godot-characterstep-demo

Supported Engine Version
4.4
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
26 days ago
Git URL
Issue URL

Character Step

These files are for a playable demo that include the main script that handles the step up/down functionality, as well as a basic third person controller and the demo level.

Go to Scripts/character_step.gd if you just want the file without the demo level and player controller.

Purpose:

This static class helps CharacterBody3D objects ascend and descend ledges such as stairs. PhysicsServer3D.body_test_motion() is used to project the character as if they were moving up the ledge to test for collision. Then either a clear position is returned or the CharacterBody3D’s original position, where the body was before the projection, is returned to indicate the ledge can not be ascended or descended.

Usage:

Be sure to utilize these methods within the CharacterBody3D’s _physics_process() and to use if statements to reduce the number of unnecessary calls. For step_up I recommend at least preventing calls if not moving. For step_down I recommend having a was_on_floor bool, in a leading if statement as well as calling when velocity.y <= 0 and not is_on_floor(). was_on_floor should be set to is_on_floor() at the beginning of _physics_process() to determine if the CharacterBody3D was on a floor before it was moved.

step_up should come BEFORE move_and_slide
move_and_slide will smooth the movement of the character after step_up

step_down should come AFTER move_and_slide
this is because if the player is not grounded but they were grounded before they moved then they have stepped off a ledge and it should be checked if they can step_down

Inspired by Godot: Stair-stepping Demo addon

https://github.com/kelpysama/Godot-Stair-Step-Demo/tree/main

It did not quite work for me for my third person controller so I built my own, taking some techniques from it, but remaking it to work as a static class so it can easily be added to any character scripts.

This static class helps CharacterBody3D objects ascend and descend ledges such as stairs or obstacles.

PhysicsServer3D.body_test_motion() is used to project the character as if they were moving up the ledge to test for collision. Then either a clear position is returned or the CharacterBody3D’s original position, where the body was before the projection, is returned to indicate the ledge can not be ascended or descended.

This is a demo level that also includes a bare bones third person controller that shows how to use the script. If you are just after the main script head here:
https://github.com/PantheraDigital/GodotCharacterStep/blob/main/scripts/character_step.gd

Play the demo:
https://pantheraonline.itch.io/godot-characterstep-demo

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Character Step icon image
Panthera
Character Step

This static class helps CharacterBody3D objects ascend and descend ledges such as stairs or obstacles.PhysicsServer3D.body_test_motion() is used to project the character as if they were moving up the ledge to test for collision. Then either a clear position is returned or the CharacterBody3D’s original position, where the body was before the projection, is returned to indicate the ledge can not be ascended or descended.This is a demo level that also includes a bare bones third person controller that shows how to use the script. If you are just after the main script head here:https://github.com/PantheraDigital/GodotCharacterStep/blob/main/scripts/character_step.gdPlay the demo:https://pantheraonline.itch.io/godot-characterstep-demo

Supported Engine Version
4.4
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
26 days ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers