Game Development Reference
In-Depth Information
Objective Complete - Mini Debriefing
In this secion, we have created a custom character control script to create the character
movement by using the Move() funcion in CharacterController class. This funcion
needs only the direcion and it returns the collision lags, which are very convenient to use.
We also apply the Gravity and Jump butons to make our character fall down when there is
no collider.
Classified Intel
In the irst chapter, we created a 2D plaform game which used a plane object to show a
sprite animaion. We also atached Rigidbody to the character to be able to use a gravity
and access to the Rigidbody class to get a nice Physics movement.
However, in this chapter we didn't use Rigidbody , but we used CharacterController
to control our character. We can add Rigidbody to our character if we want to create a
ragdoll object, but we aren't doing it in this chapter. We will take care of the ragdoll
object in Chapter 7 , Creaing a Destrucible and Interacive Virtual World .
The CharacterController script has a lot of advantages. In this case, we will talk about
the Move() funcion. This funcion takes one parameter, Vector3 , which will be the moion
of our movement per frame. So, we basically need to get the direcion from the input,
muliply the speed and Time.deltaTime , and pass it to this funcion.
The Move() funcion also returns the CollisionFlags , which we can check for each part
of our character collide to another object. This is very useful when we want to check if the
top of the character hit the ceiling, or the side of our character hit the wall, and so on. We
can read more details of the Move() funcion and CollisionFlags from the following link:
http://unity3d.com/support/documentation/ScriptReference/
CharacterController.Move.html .
http://unity3d.com/support/documentation/ScriptReference/
CollisionFlags.html .
Creating CrossFade animation
In this secion, we will apply and create the animaion clip to our character and make it
suitable for each acion such as idle, walk, run, jump, and fall animaion.
 
Search WWH ::




Custom Search