unity animation fusion

1. To attract good ideas

        In large and complex scenes, you must have encountered hands clapping, heads shaking, and legs required for other actions. However, these things cannot be done together, because sometimes a certain animation needs to be used alone. This is where it comes in handy. Animation fusion, using the animation state machine layering mechanism, you can build an animation tree on a layered basis to perform more complex operations. The process begins below.

2. Start of text
        2.1 Import animation

Select "Humanoid" humanoid animation in Rig's AnimationType, and then return to the Animation properties

 You can preview the animation here. If there is no animation preview window, you can double-click the horizontal bar below, and the animation preview window will appear.

 After previewing it, make sure that the animation can be played without problems, and modify the following parameters:

 Because my animation is a salute animation, I named it salute. After checking the above parameters, scroll to the bottom and click "Apply"Apply, then we pull the animation under this model to the Hierarchy panel, a state machine will be automatically generated, attach the state machine to the model, and bind bones to the model, and then double-click the Animator file just created. Pop up the Animator window

 Then we click on the upper right corner + Create New Level

 At this time, a new layer will be created and named idle or other names. I named it head Layer. This is used to manage the header.

 Then we need to create an animation mask under Assets, right-click Assets-Create-Avatar Mask, name it head, and hang this mask into the layer we just created.

 After selecting, pull the weight of the layer to 1, then click on the mask you just created

 Because it is a head animation, as long as the head moves, you can click on other parts to disable other parts, leaving only the head.

According to the above, we create another body layer

2.2 Call animation

 Open the Animator window, click Parameters, create two new ints, one called head and one called body, and set these as trigger conditions for different animations.

What I set here is to trigger when it is equal to 1, and the other one is the same, and then call it in the code 

 Run the project and press Q to see the character shaking his head and saluting

 Another thing to note is that some people may say to choose Additive, but when I used it, I found that the fingers of the salute animation would become twisted. I disabled everything except the head in the head animation mask, and only opened the hands. hand mask

 Okay, that’s all. See you next time

 

Guess you like

Origin blog.csdn.net/k253316/article/details/132472215