Well, I’m going to ask the question asked a thousand times: how does one make climbable stairs in the bge?

You don’t? Make an inclined plane and just have it invisible and over the stairs.

I actually made literal climbing stairs in the BGE before, to do this you mainly need…

1). An empty that is parented to the player and is in front of the player
2). A variable that calculates the difference between the empty.worldPosition[2] and the player.worldPosition[2]
3). A motion sensor that applies an upward DLoc movement (how much depends on the difference in height as seen in step 2)

An inclined plane will work too, it’s just whether or not you want to have the old-school stair-climbing effect seen in games like Doom.

That kind of works first person, but it’s not so pretty third person.

There are really three ways to handle stairs.

  1. Inclined plane.
  2. Have the character “pop” up each step by using a python raycast to get the height of the ground/stair, and setting the character to the appropriate height(with the collision mesh a small distance off the ground so it doesn’t block the character from going over short steps).
    3.Use some advanced Python inverse-kinematics solution to make it actually look realistic.

The third one is over my head, so of the other two I would recommend the first one. It looks prettier overall.

How i’m currently doing it:

I have 2 flat plane sensors stacked on each side of my player bounding box (8 total). they are .1 units outside of the box and .1 units in from the side edges. the bottom row of sensors are .1 units off the ground(base of the player box) and go up to 1 blender unit off the ground (step height). the top row is .1 unit above the bottom row and go up to 1 blender unit above the top of player box (equal to a stepheight above the player). these sensors are parented to the player box, given a collision brick (collide with anything) and linked to my player python module.

in the player module: if the player is moving in a certain direction and and the lower sensor collides with a step, check the upper sensor. if it is not colliding with anything, dLoc the player up .5 units (using .5 to make shorter steps easier. if the step is 1 unit tall it is not very noticeable that it moved twice).

the reason the upper sensors are a full stepheight above the player is so the player doesn’t teleport in to a low ceiling above the steps. if there is something blocking above, the player won’t climb the step(then you crouch to go up the step).

my only issue at the moment with this set up is that the player isn’t maintaining it’s linear velocity going up the steps. this could be fatal in an FPS fight but works perfect for third person as you can play the stair climbing animation at each step.

or you could do this,
use physics
he actually takes real steps to move…


RunFast.blend (1.95 MB)