Animations without Animgraph
Animgraph is really powerful, but it currently has a bit of a performance bottleneck with many units on screen. Facepunch's own RTS gamemode experiment ran into this issue. And, after all, the tool can be pretty complex and way beyond your needs.
You can choose to forego the Animgraph system altogether and do all your animation stuff within ModelDoc. This approach is similar to Source 1, except you're doing all your work through a GUI instead of editing a .QC file by hand.
Here's what we can do with just a small handful of animations:
- Idle (just the static default pose)
- IdleLayer_Breathe (a loop of some subtle motions)
- Walk_N (walkcycle, no weapons)
- Run_N (runcycle, no weapons)
- Idle_Sniper (weapon pose, full body)
We're going to assume that all of these are already imported as their own sequences.
Our goal: we want to be able to generate a Walk and a Run that composites our weapon pose on top. Before we do anything, we're going duplicate the movement sequences. We're gonna name them Walk_Sniper & Run_Sniper.
First, we're going to duplicate our Idle_Sniper sequence, and name it Pose_Sniper.
We'll apply a WeightList to this Pose_Sniper sequence, and we'll also tick the "WorldSpace" setting.
The WeightList will define how much the bones fade into each other, and the "WorldSpace" setting (also named "Model Space" in Animgraph) makes it so that the mixing of those bones happens relative to the root of the model space, instead of relative to each bone. Because we're not gonna be using IK here, the arms (including the shoulders) need to be 100%. We also can't be using the pelvis, this is strictly upper body. (If we move the pelvis, we move all children, including the legs, and again, no IK to put them back into place here...)
And that's it! We're done with our Pose_Sniper sequence, so we're going to add it as a layer on top of Walk_Sniper & Run_Sniper. See the video above.
This looks pretty nice as-is, but it's looking a little stiff. We should try to add a bit of weapon sway back in... and the way we're gonna do that is by duplicating Run_N. Let's name our new sequence Run_layer. We'll subtract it by itself (to make it an additive/delta sequence). Then we apply a WeightList to that sequence which only leaves the spine, neck and head bones in, weakened (10% at spine_0, slowly increasing towards 40% at the head).
Then we just need to add that delta sequence as a layer on top of our Run_Sniper animation... and we have some nice weapon sway!
The subtle idle layer is added in very much the same way: without any duplication, it gets subtracted by itself (to make it additive/delta), it gets a WeightList to only affect the upper body and not the arms, and then it gets added as a layer on the Idle sequences.
There is one caveat, though: all cycles are synced up to the parent animation. The idle layer is a few seconds long, but it's getting put on a 30-frame (1-second) sequence, so it gets sped up to match! There used to be a command to avoid this in Source 1, but the ModelDoc equivalent doesn't seem to be doing anything...