This example demonstrates how to achieve multi-layer animation blending in the Galacean editor. Through simple steps, you will learn how to blend multiple animations for a model. If this is your first time using the animation editor, it is recommended to read the previous documents:
Before starting, we need a model with animations, and it should contain an animation suitable for blending. If you don't have a model, you can download the model here. Then drag it into the scene.
We need an edited AnimatorController
. Please refer to: Edit AnimatorController.
To blend animations, we need to add an AnimatorControllerLayer
in the AnimatorController. When the Animator
component runs, all Animation Layers
will run together, and multiple Animation Layers
achieve animation blending through different weights.
For a detailed introduction to AnimatorControllerLayer
, please refer to the AnimatorControllerLayer document.
Click +
in the Layers
panel to add an AnimatorControllerLayer
Add an AnimatorState
(if you don't know how to add it, please refer to: Play Animation in Model), bind the "shakeHead" AnimationClip
in the model, and connect it from entry
to this AnimatorState. You can adjust the transition time from entry
to this AnimatorState
as needed.
Edit and bind this AnimatorController
to the model.
The default blending mode of the newly added AnimatorControllerLayer
is Override
. Let's preview the effect first.
We can see that the AnimatorState
added in the Base
animation layer are all invalid because the blending mode is Override
, which will override all the Animation Layers
below it. We can adjust the weight of Layer1
to see the impact of the weight.
We can see that as the weight decreases, the influence of Layer1
on the animation becomes smaller, while the influence of Base
on the animation becomes larger.
In this example, we do not want the weight of Layer1
to affect the Base
animation layer, so we change the blending mode of Layer1
to Additive
.
In this way, the animation of Layer1
will be superimposed on the Base
animation layer, and its weight modification will only affect itself without affecting the animation of the Base
layer.
To better observe the effect of Additive
, we delete the transition from run
to exit
in the Base
layer.