Wall Running in BGE

Okay I’ve done the best I could on researching if anyone here in the BA Forums has talked about, shared, and or even done this and I rarely got any results. The kind of wall running I’m talking about is the Horizontal Wall Running like you’ve seen in games like Prince of Persia, The Incredible Hulk, Spiderman 2, etc. not the WALL RUN UP kind of wall run. I acheived it thanks to properties and collision detection bricks however this would be faulty on animation purposes, say like I have an animation set to where the character is grabbing and running diagonally left (I also have an animation set for whenever he’s grabbing and running diagonally right), and then if the character wall runs on his right side to the wall, then how would I configure that? I haven’t seen much of people changing a player’s direction like this in the BGE as far as I’ve seen anywhere. I decided to do two methods which none has worked, yet or ever.


  1. I assigned two different materials for each side of the player’s box that does the movement and such on both right and left. One side will be a blue material and the other side will be a red material. So whenever one material collides into the wall property it will play the direction animation that’s set for that material.

However once I did that it failed and I don’t know how. Maybe player materials can’t be worked well with properties?

  1. Have a cube (hitbox) parented to each side of the player and practically do what I said on method one… which also didn’t work! I figure this method would be better since I the player’s box can detect collisions so shouldn’t parented objects do the same? I know just the main box itself works because it was able to make the armature that’s parented to it do animations. I don’t understand that.

I’m aware of doing this in python but for right now I just wanted to see if I could do this by logic bricks because I’ve yet to see if directional collisions like this is achieved. Many people said you’d have to tinker around with python to learn how to have a player enter a vehicle then get out when yet you can set up states and parenting for that, and at some codes of certain blend files I’ve came across doing just that uses states and parenting in the code so yeah.

Anyways here’s my blend file if anyone wants to get the gist of what I’m doing. If you connect the Collision with Wall Property on the Cube to the bottom “And” Sensor and slice off the Collision detection from Cube.001 you’ll get working wall running. Sorry that my blend is also messy, I tried doing Cray’s Third Person template for 2.6 since his current version isn’t made for 2.5-6 versions of Blender. Wall Running Help.blend (774 KB)

Why not simple raycast to both sides of the character that you can use to determine which side has a wall? Am I missing something?

@Kheetor Hey that works! I gotta remember that for future purposes, thanks a bundle!