Download

Animation Graph becomes unwieldy - Blend Walk/run with Crouch, Prone, Idle?

My anim graph in the animation blueprint is becoming unwieldy because of too many “small” states. I have a blend space for walk/run unarmed, another for walk/run armed, another 2 for sprint armed/unarmed, add to that crouch blend spaces, add to that prone blend spaces and so on.

I wonder if there is a way to blend the 1. stand-idle/walk/run, 2. crouch-idle/walk/run & 3. prone-idle/walk/run states into one.

That is unavoidable because Unreal Editor can’t support 3D animation blend spaces. There’s only 2D or 1D curves…

Yes you can… You can have a single state for Idle Walk Run and inside it you can use a Blend by Enum to select the various Blendspaces like stand/crouch etc. You’ll just need to create an enum and set it’s value in the event graph.

You can also call another statemachine from within your state if you want more organization like that.

you can do an 8 way, 4 speed blendspace pretty easily (idle, walk, jog, run/sprint). You can also create state machines for armed and unarmed and toggle between them.

I don’t have a Blend Poses by Enum node, I do have a ‘Blend Poses by Int’ node and I suppose that would work similarly. Thanks.

The editor auto creates Blend Poses by EnumName - jsut look for Blend Poses By YourEnumName

@KeyC0de Here’s how I have my blendspaces setup. It will require a little work to set up but in my opinion it’s worth it.

Blendspace grid …

  • Top half is forward direction (forward left | forward | forward right)

Movement Input setup …

  • Store the axis values in float vars to be referenced in the anim BP where the position will be determined.

Movement Speed (walk, jog, sprint) is set after movement input is executed.

  • My setup has multiple speeds based on armed state (armed/unarmed), locomotion state (standing, crouched, prone …eventually swimming etc)

Anim BP … simplified for post clarity

Sequence (Then 2) → SM State (function) …

  • Simplified logic for post clarity.

Sequence (Then 2) → Animation Axis (function) …

  • Convert movement axis values (Axis X, Axis Y) to blendspace graph position.

**Animation Graph … **

State Machines …

  • Entry connects to an “empty state” which transitions to a “Conduit”. The conduit offers transitions to 3 Blendspaces. Standing, Crouched, Prone.

  • Entry → Stance transition rule … for this I’m using (isEquipped? NOT) for the unarmed SM, and (isEquipped?) for the armed SM.

SM State blendspace …

Generally, blandspaces suck. You get 0 accuracy between 2 states like feet taking super short steps, or dipping above/below ground.

Depending on what you need and how much overhead you want to spend, the proper way to do this is Not to use any blendspace at all. Or if really needed the 1ds for speed variations.

Each animation in an AAA style project will likely have a matching acceleration/deceleration to it (probably recorded with root motion too).

The proper way to set up is to create nested state machines and manually control the entry and exit out of the states, so no actual blending happens ever.
You won’t have situations in which animation Run is playing at a 50% blend with Walk.

Another AAA solution to this is a custom BP node for IK speed / leg distance variation.
The speed node would take the underlying animation and augment rotation of hips to provide a wider step while still utilizing the bone limits. (Careful, the free plugins used to crash the game thread, I went and created my own).

Most importantly, splitting away blendspaces altogether provides other benefits, such as your animations can’t twitch when angles are off unless you code stuff really badly (Walk back in a 360deg. Blendspace and you’ll likely see the twitch).
Being able to have accellerate/decelerate transitions, stop animations, and different point of entries for different animations linked to a different Entry animation. (Say you have a regular jump, but the animation actually starts differently between standing still (a Precision jump; start on 2 feet land on 2 feet), walking jump (a hop in which your leading leg matters. You can delay the jump to match the correct footfall to the transition), or a running jump (similar to walking with the leading foot, but maybe a different/less relaxed contraction before jumping).
This does come to the expense of actual work to set stuff up, and animation.

TLDR: You may think your graph is unwieldy, but if you look at a professional project you may be shocked.

You can use Target Weight Interpolation to smoothly blend across blendspace animations if there is a sudden change in direction. For example this can skip intermediate animations between left and right.

Blendspace is just one tool among many that you can use. It can also be simulated with standalone alone animations in the same state and sync groups for more fine grained control than a blendspace can provide on it’s own.