In this post, I’ll talk about how I created dynamic blocking animation and firing animations in Unreal Engine 4 for my capstone project, The Draft.
The Draft is a VR swordsfighting game. One of the goals of the combat was to provide challenge and immerse the player in the game world. We had several animations that we wanted to play contextually based on the player’s position and actions. However, we didn’t have enough time to record animations for every possible reaction. It was my job to take the existing animations and create a dynamic system that would react to the player in a compelling way.
We wanted the swordsman to be able to move while blocking. During combat, the swordsman is only able to move by using various strafe animations which applied root motion. The animation solution needed to additively blend the blocking animation during movement, but not during attack and damage animations.
To do this, I created a sub-state machine for movement within my swordsman animation graph. The movement state machine handles all of the character locomotion states: strafing, running, and idle. It is then blended with a block blendspace that blends between a block high and block low animation. The layered blend by bone only applies this blend to the arms of the swordsman, which creates additive blending of the movement and blocking animations.
Ultimately, the state machine for the swordsman was fairly complex. I put a lot of work into organizing and keeping the graph clean of clutter. In particular, I’m glad that I used Unreal’s conduit system as a way to keep related animation states together (like the Attack and Stumble animations).
With the archer, we wanted to be able to have a single shoot animation and be able to have the archer aim procedurally.
Since we only cared about rotation around the Unreal Z (up) axis, I used bone rotations down the spine. I noticed that if I just rotated one spint joint, there would be stretching along the torso, so I did rotation along each of the 4 spine bones, allowing for incremental rotation up the spine.
To add polish, I created an animation curve that would define how much the procedural aim would affect the archer. Since the archer shouldn’t be aiming when drawing the bow, it stays at 0 until the bow is being pulled back, then once the shot is fired the archer returns to the rest state.
I’m satisfied with the end results for both of my animation graphs. Not only did I achieve the gameplay goals, but I made the animator happy by enhancing the existing animations to be more dynamic.