Animation Overlay System
The animation overlay system uses animation curves to combine animations of different body parts. Currently, we have the left arm(calvicle_l ~), right arm(calvicle_r ~), spine(spine_01 ~ spine_04), and neck(neck_01 ~) to blend with.
The overlay animations are played to locally override particular bones, upon base(full body) animations; that's why it's called the overlay system. For example, base(full body) animation is suitable for locomotion animations like walking and jumping, and gestures like waving, holding a phone, and drinking can be played on top of locomotion without interrupting the other part of the body.
To use the overlay system, you must first add the animation curve to the animation sequence to tell the system whether to override the bones when playing this animation sequence. When the curve value is set to 1, it enables overriding for the body part, while 0 won't do anything.
In the next sections, we will talk about how to play the animation in the best practice.
Playing Animation Montages
The animation montage is suitable for one-time use and for those states with a definite ending time, if the state is explicitly controlled by the character blueprint1. For example, waving, drinking, and the transition from standing to sitting. On the other hand, holding a phone and the sitting animation itself should be played with animation state machines.
When playing an animation montage, make sure the appropriate slot is selected. Each body part corresponds to a slot, which you can find in the LayerBlending group. The following table shows the available slots, along with the bone chain they affect.
Slot | Bone | Remarks |
---|---|---|
DefaultSlot | full body | This is the slot for full body animation montages, there's no need to add overlay animation curves to the sequence played on the slot |
Spine | spine_01 ~ spine_04 | |
Neck | neck_01 ~ | |
LeftArm | calvicle_l ~ | |
RightArm | calvicle_r ~ |
Animation State Machines
The animation state machine is suitable for animations that have an indefinite ending time, where the leave condition is triggered by some logic. For example, the locomotion animations(walking, running, jumping, and turning), crouching, sitting, and holding a phone or an object.
Add animation state machines to the base and overlay animation graphs according to your needs.
In the plugin folder Content/AnimationLayerTemplates you can find two template animation blueprints (ABP).
Copy or duplicate the base or the overlay ABP, then in the main ABP replace the linked animation graph with your newly created ABP.
To create an animation state machine, refer to the Unreal document.
To fetch variables from character BP, here's a simple way to do it:
First is to get the reference to the character by overriding the initialization event:
Then, in the EventUpdateAnimation, fetch and store the variables via the character reference:
Cast to your custom classes if needed:
-
In comparison, locomotion animations like walking start and end (one-time transition from idle to moving, and vice versa) are played by animation state machines to better couple with the locomotion graph. ↩