# How do I walk up the stairs !?

Hello,

I'm having issues walking up my stairs. Ever since I took the carpet out, the gripper rods keep scratching my toes… OK, that was a rubbish joke, but if you keep reading, I promise another carpet related joke at the bottom of the this post.

Right then. I'm looking around the forum and the wiki etc and I can't find a clear steer on how to handle simple stuff like navigating a character up the stairs. I'm seeing that you could (should?) use jme-jbullet, but there isn't AFAIK a specific handler for this. Would you do something like add a CollisionListener, and then do some calculation on the stairs that got "collided" against?

Seems like quite a piece of work when you could just (without jme-jbullet) make certain nodes (ie stairs) "terrain" and say that your "Y" value gets put on top of any collision with the stair node. I guess you'd add some height constraints to ensure you don't suddenly hop 20 feet up.

But I suppose with jme-jbullet you do get the gravity on the way down, although I'd kind of intended to keep it as a simple drop to get me started.

So as you can tell, I'm looking for a bit of experience here. If anyone has tackled the whole issue of moving around and could send me some examples, then that would be superb.

Finally, what do Mexicans always have on their stairs?

Underlay underlay!!!

Assuming your character is something bipedal (and not a car or bowling ball) I would not use physics. I tried that myself a few years ago and it doesn't work.

Physics only work with things that are propelled by forces, which bipedal characters (like people) are not. When you make a step, it's not a physical force pushing you forward as a whole. If you implement an upright physics character, it will just topple over.

Bipeds shift their weight to walk, which is not something that you would casually simulate in a 3D game. (Our brains are optimized for doing these calculations, and it still takes humans one year to figure it out…) So unless you have bowling balls rolling down stairs, or cars driving down the Spanish Steps, don't use physics.

Have you seen this example?

You cast a ray down from the camera, and calculate where it intersects with the floor nodes. Then you reposition the camera (and the player) to be 10 units (or whatever) above that intersection point.

This works with any obstacle that is lower than the cam (player's head - or where ever you decide to start the ray), as long as the ray intersects with it, and as long as the stairs are attached to the picknode (or whatever you call you floor rootnode). Have you tried that?

Thanks so much for your advice. I had not considered using a ray, so will try this out. I did check out TestPhysicsCharacter.java. I didn't see anything to allow for "upward" movement though.

My camera is going to be third person, so I may need to point the ray down from the character. I can't see a clear way to allow for upwards and downwards movement (ie going down the stairs) as part of the same calculation. Looks like two rays will be needed.

I'm gonna work pretty hard on this over the next few days, I will let you know how I get on.

Thanks again

Richard