In Unity avatars are definitions that tell
the animation system how to animate
the transforms of a model.
For humanoid models these can be configured
to your own specifications.
When you select a mesh in a Project panel
the Inspector will have three tabs,
Model, Rig and Animations.
To configure the avatar click the rig tab.
For this tutorial we are assuming that
the model is a humanoid, as such
the animation type should be humanoid.
Below that is the avatar definition property.
The options are Create From This Model,
and Copy From Other Avatar.
Copy From Other Avatar simply copies
an avatar definition from one that has
already been configured.
In most cases Unity will be able to
configure your model automatically,
in which case you will see a tick mark
next to the configure button.
Otherwise it can be configured manually.
We will discuss configuring an avatar
manually in just a moment, but first
let's finish talking about the Rig tab,
specifically the Optimise Game Objects check box.
By default Unity does not optimise model rigging.
What that means is that Unity will create
many empty game objects to represent
all of the model's bones and joints.
This gives you access to the transforms of all
of the model's parts, but it is much less efficient.
In most cases you will not need this
level of control.
Therefore it is recommended to check
Optimise Game Objects.
By checking this box Unity will not create
extra empty game objects.
Obviously not managing all of those transforms
will improve the performance of your game.
However under some circumstances
we might want to reference a particular
part of a model in code or in the Hierarchy.
We might, for example, want to add a cup of
coffee to the hand of the model.
We can still complete this in an optimised model
by exposing the transforms we want.
To expose a transform click the + sign under the
Extra Transforms To Expose box.
Then simply drill down and find the
transform you want.
In this case we will drill down
to find the model's right hand.
If you change the optimisation of a model
you will need to reconfigure the avatar
definition afterwards.
To do this click on the Configure button.
You will be asked if you want to keep the
unapplied import settings you have made
to the model, choose apply to keep your changes.
If you have unsaved changes to your scene
Unity will also ask if you want to save them
because configuring an avatar is done in another scene.
The configuration scene is empty
apart from our model with it's entire
hierarchy exposed.
The Inspector has 2 tabs, Mapping and Muscles.
First we will discuss Mapping.
This is the mapping of the model's imported
hierarchy to Unity's definition for how
a humanoid should be laid out.
Immediately below the tabs is a representation
of the humanoid model with various
circles and dots.
These represent the bones of the model.
Ones that are circled with a dotted line
are optional and are not necessary
for the definition.
On the diagram you can select which
part of the model you are looking at.
The body, head or either hand
by clicking the buttons on the left side.
Below the diagram is a list of all of the bones
organised by section with a transform that
has been applied to that bone.
In order to apply a transform to a bone
you can either drag the transform from the
hierarchy to the dots on the diagram,
the specific property below the diagram
or you can use the circle select button.
Below the list of bones are 2 drop-down menus,
Mapping and Pose.
Mapping has 4 options.
Clear, Automap, Load and Save.
Clear will remove all of the bone allocations.
Automap will get Unity to try and fit the
correct transforms to their bones.
Generally this is the best approach
to start with when configuring an avatar.
Load and Save are for dealing with
humanoid templates so you can use
configurations across multiple avatars.
These are generally not required
as Unity will usually be able to automap
your avatar.
The Pose drop-down has 3 options.
Reset, Sample Bind Pose and Enforce T-Pose.
Reset removes any pose from the avatar
and sets it to it's default.
Sample Bind Pose tries to set the avatar to
the pose in which it was modelled.
Enforce T-Pose sets the avatar
in to a T pose.
This is the way that Unity prefers to
deal with avatars.
When you have finished mapping it is best
to set the avatar in to a T pose.
When you have finished mapping your avatar's bones
click Apply to keep the changes.
Then click on the Muscles tab
to deal with the model's muscles.
If you have unapplied import settings
Unity will ask if you wish to apply them.
Under the Muscles tab are 3 groups of settings.
The first group is just for previewing
the overall range of movement of the avatar.
And if you're going to adjust any of the
muscle ranges it is best to leave these
at their default by clicking the
Reset All button.
The second group of settings are the
Per-Muscle settings.
These are grouped by body areas
and each one takes the form of a slider
which can be used to adjust the range
of muscle movement.
The number's range between -180 and 180,
representing the number of degrees of
movement around that axis.
The third section is for additional settings.
The Twist settings are how much of the
twist affects the neighbouring joints.
The Stretch settings, for how much the bones
can stretch when the avatar is retargeted
to another model.
Finally the Feet Spacing
is the default distance between the feet.
You can use this to affect things
like walking animations.
Once you have set the muscles as you like
you can apply your changes and press Done
to return to your scene.
Subtitles by the Amara.org community