2.5D-06 Wall Jumping In Unity

Eric Young
2 min readJun 30, 2023

--

A fun effect for a platformer

When creating Wall Jumping there are a few things we will want to consider:

  • Direction & Velocity should ONLY be able to be manipulated if the player is grounded.
  • We will need to access the surface normal of the object we wish to bounce off of.
  • We will need to have a bit of lift in our jump from a wall so that gravity does not drag our character down immediately

Let’s take a look at a function that will help us pursue the solution to this challenge.

This method is called when the CharacterCollider detects a collision and it takes in a hit parameter.

Our second debug then draws a ray from the character in the direction of impact(normal) and draws it in red for visualization purposes

A ray is drawn from the character’s center to the ground plane as well as to the red transparent wall

Now we will add a couple of variables to help us get the action we are looking for:

Next, we add our bool to help control the flow of the logic.

We will also incorporate our newly created Vector3 into our player’s velocity.

Finally, we update the method we created at the start of this article:

— EYE —

--

--