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!

--

--

--

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

AWS CLI version2 — Hands-On

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

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

CRODO VS FantomStarter: Battle Of Launchpads

The NINJAs Behind Our Implementations

[How-To] Install the AssetSonar Agent in your Linux Devices

Customize your iorad Widget

Tutorial Fuzzy Logic Mamdani for Arduino

Tutorial Fuzzy Logic Mamdani for Arduino

How to Refine Your Google Search and Get Better Results

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

Doing basic unit testing in Unity/C#

Journal 142 — Unity Project Development, 2.5D Shooter

Adding a burst laser powerup

Variables! — The building blocks of programming