Creating a Physics Based Character Controller in Unity

Using character controller component

Objective: create player movement with the character controller component.

Usually when we want to work with physics in Unity we use the rigidbody component and Unity provides a lot of methods like addForce that make the physics implementation easier. In this case for educational purposes I am going to use the character controller component and some of the physics have to be implemented manually.

So the first step is to add the character controller component to the player and create a new script for the player.

In the script I created a variable for the speed and another for the handler of the character controller component. In the start method I get the reference to the character controller component using the get component method.

In the update method I got the horizontal axis value and created a vector3 variable with this value in the x axis. Then I used the function move on the character controller and passed the vector3 multiplied by the speed and the real time.

And that’s it!!! Now we have the player movement ready.



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
Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.