© Casey Hardman  2020
C. HardmanGame Programming with Unity and C#https://doi.org/10.1007/978-1-4842-5656-5_36

36. Wall Jumping

Casey Hardman1 
(1)
West Palm Beach, FL, USA
 

With our player movement, gravity, and jumping implemented in the last chapter, we’ll move on to give our player the ability to push off a nearby wall for an extra midair jump.

There are different ways to design a wall jumping mechanic. You might only allow a wall jump to be performed in the opposite direction that the player’s velocity is traveling in, to enforce the idea that they are “pushing off” of the wall and redirecting their momentum.

Our system will be a bit more allowing. We’ll simply test for collisions with walls near the player, and if we can find any, we’ll allow the ...

Get Game Programming with Unity and C#: A Complete Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.