Creating A Physics-Based Character Controller In Unity

There are many different ways to make a “Character Controller” in Unity. You can hard code everything that you are wanting, use a rigid body to control your character through Unity’s built-in physics, or you could do what we’re going to be doing today and build out your player’s character controller using the actual component in Unity called the “Character Controller”.

To do this you will need to start by creating a “Primitive Object” such as a cube or capsule. Then add the “Character Controller” component to it. The character controller comes with a built-in collider, so you can delete the default collider that is provided with the object.

Next, create a new C# script and add it to your new object.

This script will move the character controller horizontally and allow for jumping.

That’s it. You should now have a fully functioning character controller fit for a 2D side scroller!



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!