Game Development Reference
In-Depth Information
Objective complete - mini debriefing
We just set up the Player sprite from the Spritesheet file that included multiple sprites by
using the Unity Sprite Import Settings to slice each sprite and rename it to make it easier
to use in each animation clip. We also create the animator controller, which is a part of the
Mecanim animation system, to switch the state between each animation clip by using the
float value and trigger condition.
The Mecanim animation system is the new animation system in Unity, which helps us to
simplify the complex interactions between each animation with a visual programming tool.
It also provides an easy workflow to set up the humanoid character animation. For more in-
formation on the Mecanim animation system, visit http://docs.unity3d.com/Documentation/
Manual/MecanimAnimationSystem.html .
We will get in more details about Mecanim in Project 4 , Add Character Control and Anim-
ation to Our Hero/Heroine .
Finally, we add RigidBody 2D and Box Collider 2D to our player. Then, we tell Rigid-
body 2D to use the Fixed Angle and Interpolate mode. Also, we set the Box Collider 2D
Material to use the Player Physics 2D Material that we've created.
Tip
Fixed Angle and Interpolate mode
Why do we need to perform Fixed Angle of RigidBody 2D ? Is this also similar to the
freezing of the rotation and position of Rigidbody ? To use Fixed Angle of RigidBody 2D ,
we basically tell Unity that it will ignore the calculation of the rotation of the object. This
will make our character always stay at the same angle while moving. In this way, we can
also save the CPU cycles because Unity will ignore the unnecessary calculation and only
calculate the one it needs. For the Interpolate mode , we've set it to Interpolate to ensure
smooth motion, which use the object's position of the previous frame to calculate the next
position. This will also prevent jerky movement. For more information on Interpolate, visit
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody2D-interpolation.html .
Search WWH ::




Custom Search