Menu
Lumberyard
Legacy Reference

Character Animation Layers

By layering animations, you can apply an animation to only a few select bones, rather than to the whole skeleton. Lumberyard has a maximum of 16 virtual layers available for use. Layer 0 is the primary base layer and contains the base full-body animations, joints, and blend spaces. Higher levels contain additive partial-body animations and overwrite animations, meaning that animations in higher layers overwrite animations in lower layers. As long as they don't share the same joints, these animations won't interfere. You can combine all layers into a single layer, which applies them to a character simultaneously.

If an animation played in layer 0 has no controller for a specific bone, the default transformation from the character rig is used instead. Layer 0 is the only layer that supports the root bone and the locomotion locator.

Each layer can play and blend animations and has its own transition queue that handles the blending in and out of animations in the layer. The default behavior for animations in a layer is as follows:

  1. Play animation once; then blend it out (weights decrease to 0).

  2. Remove animation from the queue when the weight reaches 0.

  3. Blend in the next animation (weight increases from 0 to 1).

In Geppetto, only one animation layer is active by default for previewing animations. Any time you select an animation, it plays on the default base layer. You can find the Animation Layers listed in the Scene Parameters panel of Geppetto.

To add animation layers using Geppetto

  1. In Lumberyard Editor, click Tools, Geppetto.

  2. In Geppetto, click the drop-down menu next to Animation Layers and click on Add. The newly added layer becomes the active layer for you to select a new animation from the Animations list in the Asset panel to assign to the new layer.

  3. Repeat this step for as many animation layers as you need. At any point, you can click on a specific animation layer to make it active in order to change the animation playing on that layer.

  4. Adjust the blend weight (0 to 1) for each layer.

  5. Enable and disable layers using the check boxes next to each layer.

You can enable on-screen debug information to see which animations are queued and playing, as well as information about the applied pose modifiers and IK.

Accessing Animation Layers using Code

To access animation layers via code, use the ISkeletonAnim object. In the example below, a looping animation starts on layer 2 and is fully blended in 0.5 seconds.

ISkeletonAnim& skeletonAnim = ...; CryCharAnimationParams params; params.m_nLayerID = 2; params.m_nFlags |= CA_LOOP_ANIMATION; params.m_fTransTime = 0.5f; // Starting the animation by id. Alternatively use StartAnimation to start an animation by name. skeletonAnim.StartAnimationById(animationId, params);

To smoothly blend out animations in a layer, use the StopAnimationInLayer function:

ISkeletonAnim& skeletonAnim = ...; // Blend out all animations in layer 2 in 0.5 seconds: skeletonAnim.StopAnimationInLayer(2, 0.5f);

To force the transition queue in a specific layer to immediately clear all animations:

ISkeletonAnim& skeletonAnim = ...; skeletonAnim.ClearFIFOLayer(layerId);

To force transition queues in all layers to clear immediately, use StopAnimationsAllLayers, as follows:

ISkeletonAnim& skeletonAnim = ...; skeletonAnim.StopAnimationsAllLayers();