Welcome back. Last time I explained the part about setting up my two rotators for the motion matching system. This time I will show you how I plugged that into the animations to make the actual tilting of the character.
Say you have a walking animation. The first thing you do is make a duplicate of your animation in Unreal Engine 4, and delete all the frames except the first one. To delete the frames, you right-click on your timeline and select “Remove from frame X to frame (end frame)”.
When you have a single frame, you should start rotating bones along the spine and neck, so you get a “tilted look”. You must click the “Key” and “Apply” buttons at the top, in that order, after you rotate a bone, so that position is registered.
Then, set this as an Additive Animation Type. To the left, look for the Additive Settings parameters group and set the Additive Anim Type to “Mesh Space”, and the “Base Pose Type” to “Selected animation frame”. Lastly, select your base walk animation as the Base Pose Animation. This will add the rotation offset to your animation. Do this for both left and right.
When you have done this, you need to create a Blend Space 1D. These allow you to blend your animation between various animations, using a single parameter. The image below shows how I have configured it. You can see I have the Horizontal Axis Name as “Lean” which is the name of the variable I created before (the one I told you to ignore in the meantime). In our Animation Blueprint, the “Lean” variable is the one that will drive the character tilting. Then, in Blend Samples I have the two offset poses (the ones for left and right that you created in the previous paragraph). Notice I have set it to go from -5 to 5. You can use a different number, and you can even use different ranges for different animations. For example, my walking Blend Space goes from -5 to 5, but my idle goes from -150 to 150.
Lastly, to combine the tilting Blend Space with your base walk animation, in the Animation Blueprint Editor you use the “Apply Mesh Space Aditive” node, and use the tilting Blend Space as Additive input. In the image below you can also see the Lean variable is connected to the Blend Space, as that is the one being used to drive the tilting effect.
If your character uses different speed-driven animations (walking, jogging, running, etc.) then you will need to create the different tiling poses and Blend Spaces for each one, and then set them up in your Animation Blueprint.
This video shows the character in action. I have also setup some IKs for the legs, but that is something I could explain in a future article.