Course contentsShow
← Unreal Engine Game Development
Lesson 325 of 8805. Animation and Character RiggingFree lesson

Creating Multi-Axis Blend Spaces for Fluid Locomotion

Learners will construct a two-dimensional blend space that maps movement speed and direction to seamless walking, jogging, and sprinting animation transitions.

In this lesson, you will learn how to create a two-dimensional blend space that maps movement speed and direction to produce seamless transitions between walking, jogging, and sprinting.

Moving Beyond One Dimension

Previously, we used simple one-dimensional Blend Spaces to transition based on speed alone. However, real-world locomotion isn't just fast or slow; it’s about where the character is moving relative to their facing direction. By using a Multi-Axis Blend Space (Blend Space 2D), we map two variables—typically Speed (Vertical Axis) and Direction (Horizontal Axis)—to create a grid that blends animations based on the character's velocity vector.

Setting Up the Grid

To create this, right-click in your Content Browser, go to Animation > Blend Space 2D, and select your character's skeleton.

Inside the editor:

  1. Define the Axes: In the "Axis Settings" panel, name your Horizontal Axis Direction (range: -180 to 180) and your Vertical Axis Speed (range: 0 to your max sprint speed).
  2. Placing Animations: Drag your animations onto the grid. You will place Idle at (0,0). Along the center vertical line (Direction 0), place your Walk, Jog, and Run animations at increasing speed values.
  3. Adding Strafe Logic: To make movement fluid when the character moves sideways or backward, place your "Strafe" or "Walk Backward" animations at the corresponding grid coordinates (e.g., -90 for left, 90 for right, 180 for back).

Driving the Blend

The Blend Space uses the Direction (the angle between the velocity vector and the actor rotation) and Speed (the length of the velocity vector) from your CharacterMovementComponent. You pass these into the Blend Space node inside your AnimGraph:

// Logic flow for the Blend Space node
float Speed = GetVelocity().Size();
float Direction = CalculateDirection(GetVelocity(), GetActorRotation());

As your character moves, the engine samples the animations at your current coordinates on the grid, blending them weighted by proximity. This prevents "snapping" and ensures that if your character starts running while turning, the animation smoothly interpolates between the forward-run and the side-run.

Key Takeaway: By mapping movement speed and direction to a 2D coordinate grid, you create a responsive, fluid locomotion system that eliminates harsh animation cuts during changes in travel velocity or orientation.