Avatar Mask Animation Blend

Unity's animation is roughly divided into animation fusion animation mixing. The specific thing used is probably BlendTree and Avatar Mask, the former mainly solves the problem of turning when running, while the latter is used to solve problems such as running and waving or attacking.

Here is mainly to record the experience of using Avatar Mask.

First create the Animator Controller, double-click to open the Animator Controller, add the animation you need, on the left layer layer you can see that there is only one Base Layer by default (layerIndex starting value is 0, that is, layer 0), here The layer adds basic animations such as walking.

Then click layers and click the plus sign as shown in the figure to create a new animation level.

Click on the newly created Up Layer and add the animations you want to blend on this layer, such as beckoning and attacking animations.

 

It seems that I haven't written Avatar Mask yet. . .

Right-click your Assets folder and create a new Avatar Mask. After clicking it, you can see in the inspector interface:

First click on Humanoid, click on each part of the model below, green means animation can be executed, red means not.

Then click on Transform, drag the Avatar file imported from the art to Use skeleton from, and then click Import skeleton. Unity will automatically import all the bones of the model. Here, check the bones that we need to participate in the animation blending, for example, we need to beckon. , Then only check the bones of the player department, and his child nodes will be checked automatically here.

After ticking, Ctrl S is just fine.

Then go back to our Animator Controller, click the Up layer, which is the upper body animation layer, click the settings button, and drag in the Avatar Mask we just edited. The Weight is set to 1, and then Blending is set to Additive.

After setting the conditions for triggering the animation, the model can beckon while walking, and hit while walking.

 

There is a little hole:

Blending mode setting: Override, the blended animation will overwrite the previous animation, such as the original normal walking animation. After the beckoning animation is played, when the normal walking is not beckoning, the upper body (that is, checked in the avatar mask) Bones) will not move because it is covered.

Additive, just add the mixed animation when it needs to be mixed, the original animation will not be completely covered.

----------------------------------------------20190424 update-- --------------------------------------------

The model encountered in the project plays the A animation normally, but the left (right) hand needs to make a fist.

So the art separately gave the hand movements and bones:

Then two new layers are created in the player's Animatorcontroller:

The layer settings are as follows:

Here the mask is the newly created left-hand and right-hand avatar mask:

What needs to be noted here is the setting of the avatar mask for the individual hand part, taking the left hand as an example,

Only check the left hand for humanoid, select the player's complete skeleton information in transform, and then click import skeleton, and then check only the left hand skeleton in it, and then Ctrl S to save.

Finally, add a trigger condition in the Animatorcontroller, add a bool value for the handshake action, and then set the condition, if you need a handshake, set this value to true, and set the leave action to false:

Guess you like

Origin blog.csdn.net/sun124608666/article/details/112191475