Create A Wall Jumping Mechanic In Unity

Assassin's Creed, Prince of Persia, Super Mario! All of these games have incorporated wall jumping in amazing ways. Maybe it’s just the ability to jump from wall to wall, or maybe it’s the ability to run partway up a wall and then vault yourself off and into a ledge grab or enemy tackle… No matter how you go about it, wall jumping is a fun and amazing mechanic to add to a game that can add challenge, tactics, and control to the player.

So let’s learn how to do it!

With my latest 2.5D Platformer game, I’m using a “Character Controller” component on my player so that’s how were gonna do this.

First, you’ll need to create a 3D player game object. This can be a primitive game object such as a capsue or cube. Add a “Character Controller” to it.

Next, you’ll need to create a new C# script and attatch it to your new player game object. This will control your player’s movement!

[Tip]

You can adjust your “_movementSpeed”, “_gravity”, and “_jumpHight” in the unity inspector untill it feels right to YOU.

The Character Controller has a built in function that allows you to check collisions similar to “OnTriggerEnter” called “OnControllerColliderHit”.

[Bonus Tip]

The “Debug.DrawRay” function I used there draws a line on your controller to show the direction of the noraml for the surface your touching.

A “normal” is a vector “perpendicular” to a surface at a particular point. “ControllerColliderhit.normal” will be the normal at the point of contact

[Important]

You can make walls by creating a couple primitive cubes and stretching them vertically. They should come with a non-trigger collider already attatched. Make sure to tag your wall objects so you’ll be able to reference them. I tagged my walls “Wall” as you can see in the script above.

And there you have it! The basics of creating wall jumping in your game!

--

--

--

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

DDDomain models, Ports & Adapters and CQRS reference architecture (C#)

Setting the time interval of metrics collection in Boatswain

logging.warning vs logging.warn in Python

How To Change Column Type in Pandas DataFrames

Which Coding Language Should I Learn in 2020?

Lazyload images the browser way

Tutorial ESP32 Door Lock 3in1 Fingerprint Keypad 4x3 and RFID PN532

Tutorial ESP32 Door Lock 3in1 Fingerprint Keypad 4x3 and RFID PN532

Image Optimization for your Image Heavy Website

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Reed

Adam Reed

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

More from Medium

Creating Attack Script and Collision Layers!

Journal 143 — Unity Project Development, 2.5D Shooter

Audio effects for Enemies

Making nice cameras in Unity with the Cinemachine plugin