Game Development Reference
In-Depth Information
Run Like a Zombie
A fundamental concept in development is DRY or Don't Repeat Yourself. You've already seen an
application of this in Chapter 4, when you refactor your script by taking a block of code that is
repeated and making it into its own function. This concept is also behind the power and flexibility of
Mecanim, only instead of not repeating blocks of code, the idea is to not have to repeat creating the
same kind of animation for different but similarly rigged characters. The use of avatars makes this
possible.
An avatar is a simplified humanoid bone structure that Mecanim understands how to animate. The
bones of the avatar are matched with similar units in the character model, so moving the avatar in
turn moves the character with the same motion as the underlying animation clip. A simple analogy is
that moving the strings of a marionette puppet moves the puppet in a particular way, regardless of
what character the puppet is. If you were to exchange one puppet with another, the second puppet
would respond in the same way to the same movements of the strings (Figure 5-22 ). With Mecanim,
you can similarly retarget different characters with the same animation clip. This is a tremendous
streamlining of the animation workflow in Unity.
Mecanim
(Idle)
Figure 5-22. A marionette puppet compared to a standard avatar
Now you get to see the real efficiency from Mecanim. In the Asset Store, find the Maze element Ice
Golem (Figure 5-23 ). Download and import it to your project. A folder named “player” will appear in
your Asset folder. Drill down to the golem character and select it.
 
Search WWH ::




Custom Search