The next thing we will do to create movement for our character is to create Blend Spaces for each of our movement states (Walking, Jogging, and Crouch Walking). Blend Spaces are special assets that allow for blending of animations based on the values of two inputs. In our case, we will blend between forwards/backwards and left/right movement based on the character's movement Speed or Direction.
For more information on Blend Spaces, refer to the Blend Spaces documentation.
The steps below will show you how to set up the movement Blend Spaces:
Right-click inside the Content Browser, select Animation, then select Blend Space to create a new asset.
In the Pick Skeleton window, select your Skeleton (UE4_Mannequin_Skeleton), then name the asset Walk_BS.
Open the Walk_BS Blend Space, then under Parameters, set the X Axis Label to Direction and Y Axis Label to Speed.
Set the X Axis Range to -180 to 180 and the X Axis Divisions to 4.
Set the Y Axis Label to Speed, the Y Axis Range to 0 to 200 and Y Axis Divisions to 4.
Once you have set the values for both the X and Y Axis, click the Apply Parameter Changes button.
Your set up should look like above. After clicking apply, the grid space to the left of the Parameter window will update to use our input values that will be used to determine the blending between our movement animations.
In the Asset Browser window, search for rifle ironsights animations (we will be using these motions for our character).
Locate the Walk_Fwd_Rifle_Ironsights animation, then drag-and-drop it to the bottom-center position on the grid space.
This will create a point of reference on the grid space.
Drag the Walk_Lt_Rifle_Ironsights and Walk_Rt_Rifle_Ironsights animations into the grid to the left/right of the walk forward point.
Above Walk_Lt_Rifle_Ironsights (L), Walk_Fwd_Rifle_Ironsights (F) and Walk_Rt_Rifle_Ironsights (R) are shown on the grid.
Drag in the Walk_Bwd_Rifle_Ironsights animation and place it on the bottom left end and bottom right end points.
Along the top of the grid, repeat the same layout as the bottom from left-to-right (Bwd, Lt, Fwd, Rt, Bwd).
Moving your mouse inside the grid now, you should start to see the character walking and blending between directions.
In the Anim Asset Details, under Sample Interpolation, set the Target Weight Interpolation Speed Per Sec to 2.0.
This will smooth out the blending when shifting between directions.
Save then close the Walk_BS Blend Space window.
In the Content Browser, Right-click on the Walk_BS asset and select Duplicate.
Rename the copy to Jog_BS and open it up.
Under Parameters, change the Y Axis Range max value from 200 to 375 then click apply.
The 375 value refers to the speed of our Jog that we set inside the MyCharacter Blueprint.
The grid will update to use the max speed value, however the points on the grid remain in their previous position.
Left-click on and drag each of the points up to the top of the grid at their respective locations.
In the Asset Window search for Jog animations.
Replace the walk animations on the grid with jog animations by dragging a Jog animation onto a Walk point on the grid.
Along the bottom and top of the grid we are using the Jog (Bwd, Lt, Fwd, Rt, Bwd) Rifle animations.
Save then close the Jog_BS Blend Space window.
Duplicate the Jog_BS and rename it to Crouch_BS then open it up.
Under Parameters, change the Y Axis Range max value from 375 to 160 then click apply.
In the Asset Browser, search for rifle ironsights.
Replace each of the points on the grid with their respective Crouch_Walk animations.
Save then close the Crouch_BS Blend Space window.