Game Development Reference
In-Depth Information
var angleToTarget = Vector3. Angle(direction, this.
transform.up);
if(angleToTarget < 60 )
{
this.animation.CrossFade("AimUp");
}
else if(angleToTarget < 80)
{
this.animation.CrossFade("AimStraight");
}
else
{
this.animation.CrossFade("AimDown");
}
direction.y = 0;
this.transf orm.rotation = Quaternion.Slerp (transform.
rotation,
Quaternion. LookRotation(direction), Time.
deltaTime);
if(Input.GetKey("up"))
{
...
Step 14. Play. Note how the character turns around and the animations
change to better suit the height of the target.
Research
Inverse Kinematics
For further in-depth examination of inverse kinematic systems in Unity,
download the locomotion project available from http://www.unity3d
.com/support/resources/unity-extensions/locomotion-ik.html .
3.7 Animation Management
In the preceding examples of 3D animations, character action sequences
were split into segments. In the case of 2D sprites, only one sequence was
given (walking); in the 3D examples, each action was contained in its own
separate file.
It's not always the case that animations come to game developers in this
way. If you were to download a fully animated character from a site such as
Search Nedrilad ::




Custom Search