Game Development Reference
In-Depth Information
Chapter 8. Adding Animations
Until this point, we have been successfully developing our game with the in-editor
primitives provided by Unity3D. To add a professional layer of polish, we will learn
how to add skinned models and various types of animations to our e-learning game.
We will download skinned mesh models and animations from a popular site and learn
how to integrate them into the game, as we develop a character motion system. We
will also learn about the in-editor animation editor and how it can be used to animate
static meshes (appropriate for in-game models such as buildings, cars, and statues
that are not weighted to a 3D skeletal hierarchy).
In this chapter, we will discuss the following topics:
• Exploring 3D hierarchies
• Skinned meshes in Unity3D
• Exploring the Mechanim animation system
• Exploring the Unity Animation editor
Exploring 3D hierarchies
The ability to parent objects among one another is a versatile feature in Unity3D. So
far, in this topic, we have seen how hierarchies can be used as a means of asso-
ciating objects with one another and organizing them into hierarchies. One example
of this is the character Prefabs with their child hats we developed for the player Pre-
fab and the racers. In this example, by dragging-and-dropping the hat object onto the
player's body, we associated the hat with the object body by putting the child into the
parent's coordinate system. After doing this, we saw that the rotations, translations,
and scales of the body's transform component were propagated to the hat. In prac-
tice, this is how we attach objects to one another in 3D games, that is, by parenting
them to different parents and thereby changing their coordinate systems or frames of
reference.
Another example of using hierarchies as a data structure was for collections.
Examples of this are the splineData collections we developed for the NPCs. These
objects had a single game object at the head and a collection of data as child objects.
We could then perform operations on the head, which lets us process all of the child
objects in the collection (in our case, installing the way points).
Search WWH ::




Custom Search