Game Development Reference
In-Depth Information
Creating a character control script
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 fall-
ing by using the
CharacterController
component and the
OnAnimatorMove()
func-
tion.
Tip
We can also use the
Rigidbody
and
CapsuleCollider
components instead of
Character-
Controller
. However, in this topic, we want to show the example of using
CharacterCon-
troller
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
Ri-
gidbody
and
CapsuleCollider
, we have to create those functions ourselves.