Creating a Physics-Based Character Controller in Unity
With Unity we can manage the player in different ways, we can decide to do everything with the code, or we can take advantage of the components offered by Unity as the rigidbody to manage the physics and work with the code or we can use directly the “Character Controller” that in addition to managing the physics offers us a set of data and methods that allow us to save a lot of time.
Just create a game object, for convenience use the capsule since the character controller will also provide you the collider of a capsule
Once we have added the component, we just have to create a script for the player, access the component, and start managing the movement, the jump, and everything we need.
This component offers a number of methods that I recommend looking at directly in the online scripting API