In this step, we will create a script that controls our character's movements such as forward and backward movements, turning left or right, and other actions such as jumping and falling by using the CharacterController component and the OnAnimatorMove()
function.
Tip
We can also use the Rigidbody and CapsuleCollider components instead of CharacterController. However, in this book, we want to show the example of using CharacterController because there are many convenient functions to use to control the character such as Move()
, collisionFlags
(checking where the character is collided), and slopeLimit
(the character can move up on the slope by a limited degree). If we use Rigidbody and CapsuleCollider, we have to create those functions ourselves.