How can I hit a mesh with another mesh?

My player has a melee weapon (a stick). This is a static mesh with collision all around it and is not a part of the player itself (just attached via socket).

I am trying to figure out a way to identify an overlap event and do damage to whatever it is I hit (static mesh, other player etc).

I only want the event to happen when I attack, I do not want an overlap event to happen if my weapon mesh touches something, only when it plays the attack animation.

Any ideas?

Thanks.

At what point would I set the bool back to false?

At the end of your animation, or you can directly animate the variable.

You can get a some intersting effect if you animate your varible, like the chance to get a response from your opponent if you fail an attack.

Does this mean I need to set a delay after my animation starts so it has time to finish?

Yes it works but… I will prefer to add a key to the animation and animate the value, I think it is a better way to do that.

I am unsure how to animate a variable lol

Don’t worry! You can do it whit matinee.
For now you can use the delay solution.
If you want take a screenshot of your blueprints would be good for any help

I just have a simple attack montage on click.

You can add a custom notify in your animation, and fire an event and use it to enable overlap event for your attack.

I suggest you to use state machine to have a better control of your animation states.

Nice logo btw, seems interesting!

Hi, I have added a delay and a branch when I attack which works. I really dont understand the other methods as I am new to ue4. I just want a basic event that calculates when I attack and hit something. Then from that I can trigger other events to happen.

The issue with the delay is that some animations will be longer than others.

Thanks for the help by the way but is there any way you could simplify things for me please?

:smiley:

Also I have anim montages for my attacks. I can not add them in the state machine tree. And when I ■■■ the attack animation (not montage) my legs will not move at the same time as the attacks…

I have managed to print a string when overlap begins (when I attack) sometimes the string triggers once but other times the string can trigger multiple times as it depends how long the overlap lasts. Is there any way I can calculate a damage variable based on how long my overlap is?

Thanks

After some tweaks things are getting better. It was actually my player capsule collision which was being trigger by a overlap event so I have told the overlap to ignore the player collision capsule. Now when I attack a mesh the hit detection is alright. But how do I make it more accurate?

Thanks.

Yes this method is inaccurate… You can use a get play length node from your animation and supply your delay time input.

But the best way from my point is to add a curve inside your animation, you should see a curve section in your animation, add a curve and you 'll have the animated variable, that way you can also drive the power of your attack during the animation or the effectiveness.

Is a wide question… Event dispatcher is the key. I suggest you to watch the unreal trining about blueprint communication.
There you’ll find exactly this instance.
Blueprint Communications | Live Training | Unreal Engine - YouTube 1:33:50