-
Sometimes when animating an avatar
-
we want to isolate areas of the body
-
that are actually effected by the animation.
-
For example we might have a wave animation
-
but we want to be able to wave while running,
-
walking, jumping, etcetera.
-
In order to achieve this effect
-
we can use an avatar mask.
-
In this way we can restrict the effect
-
of this animation to be purely based
-
on the arm of the avatar.
-
Avatar masks can be created and used
-
in 2 distinct ways, but the overall effect
-
of the mask is the same.
-
Avatar masks can first be created on a
-
per-animation basis.
-
For this method go to the Animations tab
-
of the Model Importer by selecting a model
-
in the Project Panel and clicking on the
-
Animations tab.
-
When you select an animations clip
-
there are a number of properties that appear
-
below the clip name.
-
One of these is a drop-down called Mask.
-
Here you can create a mask that is unique
-
to the specific animation you are editing.
-
The other method for creating an avatar mask
-
is to create it as an asset in your Project Panel
-
by right-clicking and selecting Create - Avatar Mask.
-
Once it is created it can then be applied
-
to the layers of an animator controller
-
using the Animator window.
-
Creating and applying a mask this way will
-
effect all animations on an animator layer.
-
For more information on animator layers
-
see the lesson linked below.
-
An avatar mask has 2 parts,
-
Humanoid and Transform.
-
The Humanoid drop-down has a diagram
-
of a humanoid facing you from the screen.
-
This means that the diagram's left hand
-
is on the right side.
-
By clicking on each section you can toggle
-
it's colour between red and green.
-
You can also click outside the diagram
-
to toggle between all red and all green.
-
The colour indicates which parts of a humanoid
-
avatar will be animated when using this mask.
-
Green indicates that the body part will be used
-
and red indicates that it will not be used.
-
For our wave animation we have all but the
-
right arm deselected.
-
This means that only the right arm
-
will be effected by the animation.
-
The second part is the Transform Mask.
-
Transform masks are used for generically
-
rigged models and humanoid rigged models
-
with extra bones.
-
For example, if you had a 4 legged robot
-
or a humanoid with wings.
-
Here you need to select the avatar
-
to base the mask on.
-
This is done using the circle select button.
-
When an avatar has been selected
-
and imported a full list of all of the transforms
-
for that avatar appear.
-
From this you can select or deselect
-
which transforms should be effected
-
by the animation.
-
If a transform is checked then it will be
-
part of the mask and will move when animated.
-
For example, imagine we have a
-
humanoid avatar with a tail.
-
In the base layer of the animator state machine
-
the character has it's locomotion managed.
-
On subsequent layers other animations
-
such as attacking are handled.
-
It might be a good idea for these subsequent
-
layers to have a transform mask where
-
the tail bones are unchecked.
-
This means that the tail is not effected
-
by animations on those layers
-
and will still be moved by animations playing
-
on the base layer.