2d Melee knockback based on relative location attacker to the attacked


I want to be able to send an enemy flying on impact from my character’s sword, and the way I’ve done it now is to add a static impulse on the enemy blueprint when hit. However, I want this impulse to be decided on where it was hit. For example the player swings his sword in an arc, the enemy is hit at the top of the arc I want him to be launched upwards. I thought about making a variable in the damage type and sending that to the damaged enemy, but that would still be a static number, and I can’t find out how to make it fly right if the player is on the left side of the enemy and vice versa. Please help!

I forgot to say, this is in 2d! So I have melee capsule that tracks overlapping actors to determine if something is being hit.

How do you track the sword hit? Is there any Hit Data that you could use to determine the HitNormal or something? I can only think about working with the HitResult and a Vektor that determines from where the enemy was hit.

Ehm, i can’t imagine how this looks :X Could you provide me a picture of what you want to achieve. Maybe my brain gets an idea then :smiley:

Should’ve posted pictures in the OP, but better late than never

Maybe I should add a radial impulse emitting from the center of the melee capsule or something? How would I go about doing something like that tho.