THIS CONTENT DOWNLOAD SHORTLY

Objective

Main objective of this blog post is to give you an idea about how to Animate Specific Body Parts Using Avatar Mask in unity.

 

Step 1 Introduction

Specific humanoid body parts can be selectively enabled or disabled in an animation using so-called Body Mask. This is used in the Animation tab of the import settings of the imported file and Animation Layers. Body masks enable you to tailor an animation to fit in the specific requirements of your character more closely.

You have waving animation that includes sitting on something that includes hand movement, and legs are in sitting position. If you don’t want your waving animation in sitting position and you want it in standing position, you can use the standing wave animation by switching off the leg movements/position in the body mask.

 

Step 2 Different Body Part

The body parts included are: Head, Left Arm, Right Arm, Left Hand, Right Hand, Left Leg, Right Leg and Root (which is denoted by the “shadow” under the feet). In the body mask, you can also toggle inverse kinematics (IK) for hands and feet, which will determine whether or not IK curves will be included in animation blending.

body-parts-included

Click the avatar section to toggle inclusion or exclusion (green/red)

Double click on empty space surrounding the avatar to toggle all

In the Animation tab of the mesh import inspector, you will see a list entitled Clips that contains all the object’s animation clips. When you select an item from this list, options for the clip will be shown, including the body mask editor.

You can also Create Avatar Mask Assets ( Assets >> Create >> Avatar Mask ), which show up as .mask files on disk. The Mask assets can be reused in Animator Controllers, when specifying Animation Layers.

A benefit of using Masks is that they tend to reduce memory overheads since the body parts which are not active do not need their associated animation curves. Also, the unused curves need not be calculated during playback, which will tend to reduce the CPU overhead of the animation.

 

Step 3 Create and Use Avatar Mask

I have a waving animation in sitting position but I want to play it on a standing position. Import your character model and set animation type Humanoid from Import Settings in Rig tab and click on Apply button. 

humanoid

Create an avatar mask Assets >> Create >> Avatar Mask. And set up Avatar as per your requirement. 

mask-inspector

Avatar mask in the Mask inspector (legs excluded). Add a new layer in Animator and assign your new mask into the Mask. 

new-layer-in-animator

And setup its weight - 0 to 1, and tick IK Pass. Add an Idle Animation clip to Base Layer (i.e. simple standing animation). 

base-layer

Wave Animation Clip (Mask Layer):

wave-animation-clip

Wave animation with Avatar Mask (Standing position) without Avatar Mask (Sitting Position):

wave-animation-with-avatar-mask

I hope this blog post will help you to Create Animate Specific Body Parts Using Avatar Mask. Let me know in comment if you have any questions regarding Unity. I will reply you ASAP.

Got an Idea of Game Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best Game Development Company in India.

I am 3D Game Developer and Android Developer with an aspiration of learning new technology and creating a bright future in Information Technology.