Making an Isometric Character Controller Jump in Unity

kristielAll Topics, Game Design & Development Tools, Tutorial, Unity Game Development

Making an Isometric Character Controller Jump in Unity

Share this Post

A couple of weeks ago, I wrote about how to create an isometric character controller in Unity 3D. I even made a video with instructions! The video has done surprisingly well and it has received a fair number of comments asking me questions. A lot of people want to extend the character controller in certain ways. Specifically, several people were interested in making the character jump. Fortunately, I’ve figured out a few ways to incorporate jumping on our isometric character controller. This post will look at the mechanics of jumping in video games and how we can make our isometric character controller jump.

The Basics for this Unity Tutorial

First, let’s talk about jumping in a normal, 2D side-scrolling video game. A 2D game can be represented using a normal coordinate plane like you would see in many math disciplines (Geometry, Trigonometry, and Physics, for example).Unity Tutorial 2D Coordinates

In Unity, game objects have a transform component that contains positional information about that object in 2D or 3D space. This allows us the ability to grab X and Y values and change them. Thus, if we want motion in the positive X direction, we can increment the transform’s X value and create the illusion of our object moving to the right. Likewise, if we want to jump in the positive Y direction, we can increment the transform’s Y-axis value and create the illusion of our object moving upwards. In just about every 2D game I’ve ever played, the player is also able to jump in the air and continue moving in the horizontal direction simultaneously. This can be done by combining X and Y-axis movements.

This is a widely used mechanic in side-scrolling platformers where precision is a crucial gameplay element. Allowing your character to move horizontally and vertically simultaneously can be beneficial and it is not difficult to implement.

Jump Across

Jumping in an Isometric World

Now, let’s consider a 3D game. In a 3D game, the main difference is you now have an additional Z-axis. For jumping, this Z-axis doesn’t matter much because we’re still using the Y-axis for jumping. Consider our implementation of an isometric character controller. We are using Z and X to move our character around on our plane. If we want our character to jump, all we need to do is make them move in the positive Y direction.
Isometric Jump

In the 3D realm, we can still do a moving jump. The main difference is that we need to account for the Z-axis now. It’s possible that our player is running in the positive Z and X directions and then initiates a jump. In this situation, we just continue to increment our X and Z transform values while also increasing our Y transform value.

Physics or no Physics?

PhysicsThere are several ways we can implement our jumping mechanic. Which implementation you choose will largely depend on your vision for your game and what feels the best to you. One of the biggest considerations is to think about how physics will affect the jumping. Do you want gravity to influence your upward and downward motion? Maybe you just want gravity to affect downward motion but not upward motion. Maybe you don’t want gravity to have an effect at all. What about momentum? If your character is moving and they jump, should they have forward momentum that cannot be easily stopped? Maybe you’re making a platformer and you need your player to be able to control the character’s movement while in the air. This would require you to rethink using momentum.

These are all very valid design questions about your game. And your decisions will affect the way you implement the jumping mechanic. In Unity, if you want to rely on gravity and forward momentum, you’ll want to utilize Unity’s Rigidbody components and libraries. If not, then you’ll largely be manipulating the character’s transform values to create your jumping mechanic. In my experience working on this mechanic, it’s beneficial to try multiple implementations and see which one you prefer.

Tutorial Video

Before watching the video, I recommend watching my previous video or reading my previous blog so you have some context for my code.

Conclusion

Hopefully, you see that it’s relatively simple to implement jumping in our game. However, jumping can become rather complicated depending on how you want to implement the mechanic. It’s important to try several different implementations and get a feel for each of them and see what you prefer. Good luck!

Be sure to check out Studica.com for academic discounts on software, electronics, robotics and more. Sign up for Studica’s email newsletter* for even greater savings!

Blogger: Mark Philipp, Application Engineer at Studica

Share this Post