How do I add a simple melee attack animation to my 3rd person player?

Hi guys & gals!

I am trying to make a third person game these days and managed to set up some basic animations (idle, run, jump) in my character animation blueprint. Based on variables from the event graph, my character can now do exactly what the third person template character can do, but now I also need to add some additional animations like various melee attacks and randomized idle animations.

I have read through the docs and tried various methods, but I just cannot understand how to do this. As far as I understand, I would have to get/create a variable in the event graph and then pass this into my animation graph, right? I just can’t seem to figure out how I can get an input event (left mouse click?) to trigger an (additive?) animation and I am about to lose my sanity.

Could anyone please point me in the right direction?

All the best,

Roald

You would first need to create an anim montage. You do that by right clicking on your animation and selecting “Create Anim Montage”

Open up the montage and you will be able to set the name of the slot. Call it “FullBody”

3132-slot.jpg

Now go to your anim blueprint > animgraph and set up the SlotNode in between the state machine that runs the idle and run animations and the Final Pose Node. Make sure to call the slot FullBody.

Now in your characters blueprint you can play animations this way.

If you would like to have it play in code, its a different set of things you have to do.

Thank you very, very much for the quick reply!

I managed to get it working, well, sort of, but the question now is how I can only affect the upper body of my character? Right now, the entire character blends into this new animation, which is unfortunate, so I wonder how I can make my player run and play this animation at the same time?

This is how it looks now btw:

Thanks again!

All the best,

Roald

You can create another node and call it TopHalf slot. Set the bone to use where it starts blending the top half anim. In my case it starts at b_Spine1.

Make sure the anim montage has the slot name set to TopHalf.

You need to copy your state behavior so that it blends with it like in the image.

Then connect the nodes like so :

That seemed to do the trick :slight_smile: If you ever visit Norway, I`ll buy you a beer or three :slight_smile: Thanks a lot!

Now I just gotta figure out how this melee animation could inflict damage on enemies.

Thanks again!

Roald

Ha no problem!

I’m sure you already found a way, but for anybody looking for a tutorial about how to inflict damage I would like to share this basic one:

http://javierramello.com/index.php/tutorials/51-unreal-engine-4-damage-collision-box

I hope it helps!