UDK - Animation Blending in Matinee

Uploaded by wasabimilkshake on 20.04.2010

This tutorial will show you how to animate skeletal meshes in Unreal by blending between
different preset animations with Matinee.
I'll start by showing you the simplest method, so you can see why we'd want to blend animations.
I'll be using a very simple example in this tutorial, with the player character running
across a level and coming to a stop.
Now, in this sequence, you can immediately see why animation blending is necessary. Without
it, the transition between each animation is instant and jerky.
Now this is a simple SkeletalMeshActor, which has been animated in Matinee to go from idle,
to running, then back to idle.
With this type of actor, this is as about detailed as you can get in specifying how
animations should be played.
In order to use animation blending, there a couple of things we have to change. First,
though, you should make sure you know the very basics of Unreal's animation systems.
Let's take a quick look at the types of Objects that make up an animated character.
You're probably already familiar with Skeletal Meshes. These are the character models, rigged
to a skeleton consisting of a hierarchy of bones. Animations are created by moving those
Next is an Animation Set, or AnimSet. AnimSets can be applied to different skeletal meshes,
so long as they have the same rig. An AnimSet contains multiple Animations, which describe
how the mesh's bones should be moved and rotated over time.
Finally, we have Animation Trees, or AnimTrees. These aren't in the Content Browser favorites
list by default, so I like to add them. Now I'm not an animation guy, so you'll have to
excuse the simple explanation, but an AnimTree basically provides controls and constraints
for morphing skeletal meshes and blending animations. We're interested in everything
that's plugged into the Animation input. As we adjust the values on each node, the AnimTree
blends seamlessly between different states. I want to point out two of these nodes, TopHalfSlot
and FullBodySlot, which are called Slot Nodes. Slots allow you to affect only a certain part
of the skeleton. For example, you could apply a running animation in the FullBodySlot and
a taunting animation in the TopHalfSlot, and the character would taunt with his upper body
while running with his lower body. However, something like blending from idle to running
is a full-body animation, so we'll need multiple channels in the FullBodySlot in order to blend
between those animations. The default Human AnimTree that comes with UDK only has one
channel in each slot, so we'll have to create a copy and modify it slightly.
So let's right-click on AT_CH_Human and create a copy. You can save this to a package of
your own, but I'm just going to put it in my map file, under the name AT_CH_Human_MultiChannel.
Once we have our new AnimTree, we can open it up and find the slot nodes. To add a channel,
you simply right-click on the node and select "Add Input." I'm just going to duplicate this
blank node and plug it into the channel we just created. Now we can save our package
and start setting up our animation. And I'm going to delete what I have so we can start
If you look in the Content Browser for Skeletal Meshes, you'll SK_CH_LIAM_Cathode. I mentioned
that in the previous example, I was using a regular SkeletalMesh. For blending animations
in Matinee, you'll want to use a SkeletalMeshMAT. So let's place that Actor in the level and
position it. Since we're blending animations, we need to give this Actor an AnimTree. So
find the AnimTree that you created earlier, select it, and enter it into Anim Tree Template
in the Actor properties. That's under SkeletalMeshActor -> SkeletalMeshComponent -> SkeletalMeshComponent.
And since the mesh is going to be moving across the level in the Matinee sequence, we also
need to set its Physics type to PHYS_Interpolating. This is under the Movement properties.
Once that's done, we can open up Kismet to create our Matinee sequence. I'm going to
add a Player Spawn event so we can play this sequence as soon as we launch the level, and
I'm also going to make the Matinee sequence loop.
In the Matinee sequence, let's add a new Empty Group with the SkeletalMeshMAT selected. In
order to animate this mesh, we need to specify an AnimSet for it to use. So open the Content
Browser and find K_AnimHuman_BaseMale, select it, and add it to the Group Anim Sets list
under the Group's properties. Now we can add a Movement track to the group, since we'll
be moving the mesh shortly. In order to cue different animations, we need to add an AnimControl
track. If you set your Skeletal Mesh's AnimTree property correctly, you should be given two
slots to choose from. We're going to add a FullBodySlot.
Now, if we were using the default Human AnimTree, we wouldn't be able to add any more FullBodySlots,
and we'd have a problem. Since we added a second channel to our copy of the AnimTree,
we're able to add one more track for the FullBodySlot.
When you add a key to the AnimControl track, you're asked to choose an animation from the
AnimSet you specified in the Group's properties. I'll go ahead and choose our starting animation,
CC_Human_Male_Idle. In the second track, I'll add a keyframe for run_fwd_rif, and I'll set
it to looping. You'll notice that the Mesh isn't performing either of the specified animations
just yet. Right now, it's in the default pose for the AnimTree because the weight assigned
to each track is currently at 0.0. In order to adjust these weights, we need to use the
Curve Editor.
If we send both of these tracks to the Curve Editor, you'll notice that they're both at
0.0. To add a keyframe to the curve, control-click where you want the key to be placed. Unlike
with movement tracks, keyframes in the AnimControl track are decoupled from keyframes in that
track's curve. That is to say, we can move a curve keyframe left or right without affecting
the time at which a track keyframe is placed.
The AnimControl curve will blend between 0.0 and 1.0, 0.0 being the default pose, and 1.0
being the animation specified in the track. When you have multiple tracks, you can blend
them so that their weights add up to 1.0. For example, when both of these tracks are
at 0.5, the mesh will be halfway between standing and running. So, what I've just showed you
is how to blend between animations in Matinee. I'll go ahead and finish the sequence so you
can see the difference between this and what I showed you earlier.
So, this is not the best keyframing job you've ever seen, but hopefully I got the point across
and you learned a thing or two about blending animations in UDK.
Thanks for watching.