Saturday, January 21, 2012

Animation blending and aim poses in the engine

I've been working on an animation system that uses the "Animation Tree" approach to defining how multiple animations should work together. It's a fairly typical method of defining how the animations a character might be used; Unreal, Unity and pretty much every game engine of any complexity has to manage animations and from what I have seen, this requirement is usually met with some sort of animation tree system which allows you to break down the complexity of the total set of animations to more manageable groups of nodes that can be considered in small inter-dependent groups.

The first nodes I created were pretty basic and set the framework for the nodes going forward: play an animation on the entire skeleton. Play one sub node, play all sub nodes, that sort of thing. The past few days have become much more interesting because I created animation nodes that are used to blend between different animations using different logic to control the blending.

The first blend node just does a weighted blend between a set of animations. The second one remaps an XY input to control blending between 9 animations on a 3x3 grid; this one is used to control "aim sweep" and other similar motions where the character needs to have a specific pose based on some game state - typically where they are pointing their weapon or otherwise focusing their attention.

The end result is I now have a system where I can make the characters walk and chew gum at the same time. Or walk with the lower body and aim with the upper body, as seen in the videos below.

There are quite a few animation nodes that need to be made, but so far I am really liking how this is working and I feel pretty good about this being a functional solution for controlling animations.