Game Development Reference
In-Depth Information
Step 10. Play. The CrossFadeQueued() function sets up an animation
to play after currently playing animations finish. It also fades between
animations, which, in this case, allows for a smooth transition between
jump and idle.
3.7.3 Blending
While cross fading animations allows for one model posture to smoothly
Animation blending allows for different parts of different animations
to be combined.
Unity Hands On
Animation Management
Step 1. Download Chapter Three/
from the Web site. Unzip and open the project in Unity. Open the
animationManagement scene and play. The WASD and arrow keys
can be used to move the character around the environment.
Step 2. Open the AnimationManager.js file in the script editor.
Step 3. Note the use of the Input.GetAxis() function. It is a clean
way to get the character movement from typical game control
mappings. For example, using Input.GetKeyDown() for all the
different keys to move forward and backward would be many more
lines of code than the two given here.
Listing 3.24 Script to Play FireGun Animation When Space
Is Pressed
private var speed = 0.03;
function Update ()
this.transform.Translate (0, 0, translation);
this.transform.Rotate (0, rotation, 0);
Search Nedrilad ::

Custom Search