O'Reilly logo

Unity 4 Game Development HOTSHOT by Jate Wittayabundit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required