Animation Blueprint: Locomotion with and without weapons

Hi,

I have downloaded the Animation Starter Pack:

My players can walk around without a weapon, with a rifle and with a pistol. So based on that are 3 different sets of animations for the locomotion and I am wondering about how to differentiate between them in the Animation Blueprint.

An easy solution would be to duplicate the Locomotion state machine 2 times and then have the locomotion animated without weapons, with a rifle and with a pistol. Then I could blend the locomotion animation into the final pose based on which weapon the player has equipped.

However that seems not very performant since the animation blueprint would have to calculate 3 poses each frame instead of just one and I plan to have many pawns based on the ABP in the scene. The more weapon types I integrate the bigger the problem would become.

So I was wondering is there a way to store the right animations in variables and then just assign the animation from a variable to the animation output? This way I can use just one locomotion state machine and reassign the correct animations whenever the player switches between weapons or no weapon.

Or is there another best practice for this?

Thanks in advance

1 Like

To adress your question directly, yes that is possible.
By setting the “Sequence” Property to be exposed as a pin in the details panel of your node in the Animation Blueprint, you can use it as a variable and select like that.

Alternatively you could use the Animation Blueprint Linking and just have a “locomotion” layer as a base in which you can link whatever animation layers you need for the other locomotion.

I am not aware of any inherent performance benefits of one over the other, or compared to entirely different approaches(which there are various with different advantages and disadvantages), but as I see it, the linking is the intended way of handling it for projects at scale. If your project doesn’t require the benefits the linking brings, I guess you’d also be fine using the approach you asked about.

1 Like

Oh this is perfect, thank you very much! It’s so hard to find these things when you don’t know what to look for.