Play an animation when a button is pressed / Проигрывание анимации при нажатии кнопки

Hello. I already have Idle-Run animations. I need to make sure that when I press the LMB, an attack animation will play. Unfortunately, I didn’t find any useful material, so I’m turning to you

==========

Привет. У меня уже есть анимации Idle-Run. Мне необходимо сделать так, чтобы при нажатии ЛКМ проигрывалась анимация атаки. К сожалению, не нашёл полезного материала, потому обращаюсь к вам

You can use animation montages for that purpose :innocent:

Right click on your attack animation asset, navigate to the Create section on the menu that pops up, and select the Create Anim Montage option. Then, go to your animation blueprint, open up your anim graph, and there right click on an empty space, search for “Default Slot”, and select the "Slot ‘DefaultSlot’ " from the menu. Once you place the slot node (it should be a grey node) plug it’s input (Source) pin into an animation or a locomotion (state machine) and plug it’s output pin into the Out Pose. Do not perform this inside a state or anything, just connected it to the main Out Pose of your anim graph.

Now, open up your character blueprint, get your input action for the attack mechanic and after it’s Started pin, place a Play Montage node. Then finally, select your anim montage asset from the dropdown menu inside that node and you’re all done!

Hope this helps :blush:

look for offical content example in the epic games launcher. you’ll find what you looking for and much more useful stuff.