2.5D Platformer — Simple Walljumping #6

Jumping towards new heights

Another basic (and popular) feature in a Platformer is Walljumping. Today, I will show you how you can start implementing it in your projects.

Quick Note:

Because Walljumping applies a force to the controller, if you set up your controller like mine that handles the movement through input rather than momentum, you won’t be able to control your controller mid-air. This can be quite frustrating as responsiveness is videogames is very important.

But because this is a mini-tutorial, I’ll only spare the information you need to walljump.

You’ll only need a Character Controller component. Using the integrated method OnControllerColliderHit, we can easily check for walls. You can do this with Raycast if you’re unsure about using this method.

For our controller, we’ll only allow walljumping if the player is not Grounded and the hit point normal angle is 90 degrees. We’ll store the normal to push the controller off the wall.

In our JumpInput method, we’ll add the WallJump functionality to make this work. Depending on the side of the wall we’re colliding, we’ll want to push off the controller from the wall with a new HorizontalSpeed and a new VerticalSpeed.

--

--

--

Junior Unity Developer

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

Recommended from Medium

How We Implemented Vehicle Mechanics in Our Game — Part 6

HowTo: Kafka Connect

How I wrote a chess algorithm for my game

Is front-end web development easier than back-end web development?

In anticipation of the KubeCon + CloudNativeCon conference that will take place in Valencia, Spain…

Getting started with Apache Allura and Contribution Guide

Member Login

Window 10 Shortcut Keys

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
Pablo Gómez Platón

Pablo Gómez Platón

Junior Unity Developer

More from Medium

It’ll be worthwhile to get the levels you need

Why I Want to be a Camel

Top 3 NFT projects to explode in 2022

NFT CF Key: What these keys are and why they are priceless