Unreal Engine Animation Slots

admin  4/6/2022


Project Files : https://www.patreon.com/CodeLikeMe/posts?tag=source%20code
Support my work on Patreon : https://www.patreon.com/CodeLikeMe
Last time we added a sword equip and sheath functions to our character. But these animations are played as if the character is standing still. But, we need our character to be able to equip and sheath sword while moving as well. In this episode, i’ll show you how to make these animations independent from the stance or movement of the character. For this i’ll use unreal layered animation system with animation slots.
source

  1. Unreal Engine Animation Slots 777
  2. Unreal Engine Animation Slots Games

When in reality what actually happens is that the function is expecting an animation sequence to use to create an animation montage, and the slot name you pass it is the slot name in the new dynamically generated montage. In fact the first check in the code is to see that it is NOTan animation montage. I have desperately been trying to make a single wheel rotate around to simulate a wheel in a slot machine using Blueprints The wheel consist of 15 faces (24 degrees per item): So for each 24 degree a rotate the wheel, the face of the slot machine will change perfectly. The catch is the Animations need to be the same length so that all animations fit within the AnimMontage sections you defined. Then in your Animation Blueprint you would use a Blend By Boolean (or Int) to switch between using a Sword Slot or the Unarmed Slot thus playing a Sword animation when wielding an Sword or an axe Animation when wielding.

Slots

Related posts:

This might be a little late but for posterity's sake I figured I would answer this question.

Unreal Engine Animation SlotsAnimationUnreal

PlaySlotAnimation() and PlaySlotAnimationAsDynamicMontage() are a bit strange because the Asset parameter is of the UAnimSequenceBase class, but the function name suggests that you pass it an animation montage (UAnimMontage) and it plays a slot in that montage. When in reality what actually happens is that the function is expecting an animation sequence to use to create an animation montage, and the slot name you pass it is the slot name in the new dynamically generated montage. In fact the first check in the code is to see that it is NOT an animation montage:

Slots

So if you pass in an animation montage, the asset will always be marked as NOT valid and the function will exit.

Unreal Engine Animation Slots 777

In other words, you can't use PlaySlotAnimation() or PlaySlotAnimationAsDynamicMontage() to play a slot in an animation montage that already exists. You'll just have to create multiple animation montages and use MontagePlay() to play them.

This is a bit of a strange design decision, if someone from Epic could clarify as to why there is not a function to play an animation from an existing montage that would be awesome; maybe I just missed it? The function naming is poor though IMO, something like PlayDynamicMontage() may have been better. I would be interested to hear someone else's thoughts though.

Unreal Engine Animation Slots Games

(Referencing code at ea7b5e4da1ca360c4800fc11f1125c3c38f68f12, which is on the 4.19 branch)