Wall Jumping in Unity

Going over how I implemented a wall jump mechanic in Unity

Gabe Gomez
2 min readJul 22, 2021

Objective: Implementing a wall jump mechanic for my 2.5D game.

Setup

I went ahead and created this area to test out my wall jump mechanics to get started for today. As you can see, it connects to the elevator from my previous article.

The Functionality

To get the wall jump mechanic working, the main function we will be making use of is OnControllerColliderHit(). This function is called anytime a GameObject collides with another. With the code we have here, we can visualize the surface normal of the GameObject the player is colliding with.

This is useful for us as we can use that information to wall jump in the proper direction given those normals. To get this to work took a good amount of code, but here is the main chunk of it:

All this code gave me the following result:

That’s all for today! Thanks for reading today’s article! In the next article, I will be working on pushing a box onto a pressure pad.

--

--