Skip to content
Tutorials Center
My learning

Topics

Lesson 30 of 38 ยท Animation and AI

Blend Spaces and Animation Montages

Blend walk and run smoothly with 1D and 2D Blend Spaces, and play one-off actions with Animation Montages, sections, slots and notifies in Unreal Engine.

A character does not just switch between "walk" and "run". Speed changes continuously, so the animation must too. Blend Spaces solve that by interpolating between several animations based on one or two numbers. Animation Montages solve the opposite problem: playing one-off actions (attack, reload, emote) that interrupt or layer over normal movement.

The Unreal Editor is not available on this site, so the editor steps are in words. The Python stand-ins implement the interpolation.

Blend Spaces

Create one with right-click > Animation > Blend Space (or Blend Space 1D) and pick the skeleton. In the editor you will see a graph whose axes are named parameters.

1D Blend Space. One axis, usually Speed. Set the horizontal axis range, for example 0 to 600 cm/s. Drag animations from the asset browser onto the graph at sample points: Idle at 0, Walk at 200, Run at 600. When you hold Ctrl and move the cursor you preview the blend, and at runtime the engine interpolates poses between the two nearest samples.

2D Blend Space. Two axes, for example Speed (0 to 600) and Direction (-180 to 180). Now strafing works: animations for forward, backward, left, right and diagonals placed on the grid, and the engine blends among the surrounding triangle of samples. Rotation and locomotion that feels right with a camera-relative control scheme uses this.

Important settings:

  • Axis Settings > Smoothing Time: how quickly the value follows changes. Smoother output hides sudden input changes.
  • Interpolation Type / Damping Ratio: shape of the smoothing.
  • Sample Smoothing: helps blend close samples.
  • Grid divisions: how fine the editor grid is, not the animation quality.
  • Sync groups and Marker Sync: make a walk and run cycle share a sync marker (foot-down) so feet line up when blending. Without it, blending two cycles of different length can look like skating or hopping.

Use the blend space in the Anim Graph (see Animation Blueprints and state machines) by dragging it in and connecting Speed (and Direction) variables to its input pins.

The 1D interpolation in Python

Python Stand-in: 1D blend space

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Speed 900 is clamped to the axis maximum of 600, as the editor does.

2D blending with weights

For two axes the engine picks the triangle of samples around the input and uses barycentric weights. The stand-in below does the simpler case of bilinear blending on a rectangular grid with four samples, which shows the same principle.

Python Stand-in: 2D bilinear blend

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Animation Montages

A montage wraps one or more animation sequences into a controllable asset. Create it by right-clicking an animation sequence and choosing Create > Create Anim Montage. Inside, you can define:

  • Slots: named tracks (for example DefaultSlot or UpperBody). The Anim Graph must contain a matching Slot node, otherwise the montage plays nothing.
  • Sections: named regions such as Windup, Strike, Recover, which you can jump between, for combo chains (Attack1 to Attack2).
  • Blend In / Blend Out times and curves.
  • Notifies: events fired at exact frames. A Anim Notify can play a sound or spawn a particle; a Notify State has a start and end, which suits "weapon hitbox active".

Play and control a montage in C++:

C++
void AMyCharacter::Attack()
{
    if (UAnimInstance* Anim = GetMesh()->GetAnimInstance())
    {
        if (AttackMontage && !Anim->Montage_IsPlaying(AttackMontage))
        {
            Anim->Montage_Play(AttackMontage, 1.0f);

            FOnMontageEnded End;
            End.BindUObject(this, &AMyCharacter::OnAttackEnded);
            Anim->Montage_SetEndDelegate(End, AttackMontage);
        }
    }
}

or with the Play Anim Montage Blueprint node, which has pins for finished, blend-out and interrupted. Jump to a section with Montage_JumpToSection(FName("Strike"), AttackMontage).

Notifies drive gameplay

Gameplay code should not guess when the sword hits; the animator places a Notify State named Hitbox over the swing frames. In the Anim Blueprint or the character, you respond with a function that turns collision on and off. That keeps timing in the animation asset where artists can edit it.

Python Stand-in: notify state window over a montage timeline

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • No Slot node in the Anim Graph. The montage plays silently.
  • Blend spaces without sync markers. Visible foot sliding when blending different cycle lengths.
  • Triggering a montage every frame. Check Montage_IsPlaying first.
  • Root motion confusion. If the animation moves the root, enable Root Motion on the sequence and Root Motion Mode in the Anim Instance, or the character will play in place.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a 1D Blend Space do?

    It blends the poses of the nearest samples based on one input value.
  2. 2. A montage plays nothing at all. What is a likely cause?

    A montage plays through a named slot; the Anim Graph needs a Slot node with that name.
  3. 3. Which tool lets an animator mark the frames when a weapon hitbox should be active?

    A Notify State has a start and an end on the timeline, ideal for active windows.
  4. 4. Why use sync markers in a locomotion blend space?

    Marker sync aligns foot-down moments, preventing foot sliding when blending cycles.

Summary

  • Blend spaces interpolate poses along one or two parameters; use smoothing and sync markers.
  • Montages play one-off actions through slots, with sections, blend times and notifies.
  • Drive hit timing from Notify States, not from guessed times in code.
  • Always check Montage_IsPlaying before starting an action again.

Next: Behavior Trees and Blackboards