Sending variables to enemy on collision?

I’m trying to set up a collision system for a fighting game.

I’m wondering how I can get the enemy to know what move hit them?

Punch or Kick
what reaction animation to play

I’m not sure how to set this up, any suggestions.

I have a character running around, punching and kicking already, with some basic overlap collision detection, but I need the details, so the other character knows how to react.

Well you have the “Event Hit”. This provides you with information about where the hit occurred (“Hit Location” which is a vector) as well as the “Other actor” (which actor caused the hit).

You could play around that a bit and look if that helps.


I’ll try that, but I stayed away from the Event Hit, because I need an Overlap. A foot during a kick needs to be able to pass through the enemy, like it does in regular fighting games. Not collide like a dynamic reaction, or like you see in real fight simulators.

I think I found how to do it, using a Blueprint Interface.

After figuring out how to send info, I was having trouble with the character hitting themselves when throwing a strike.

I fixed the self collision on whiff with the ignore actor node in the construction graph when attaching the collision spheres to the hands, feet, etc.

So then I ran in to a problem with him getting hit still but only when making contact with an enemy. Throw a kick, and both would reel back on impact.

I fixed that by making two collision presets. One Blue spheres = where character can be hit. And Red spheres, which are used to hit the blue spheres.

Blue spheres ignore blue Spheres
Red spheres ignore red Spheres.

So now I need to enable overlap events on all collision spheres.

On the get hit spheres, the blue ones only, down in the details panel for them, add an “On Component Begin Overlap” Event.

Use that as the trigger for the hit state in the Event Graph, on the victims end.

I haven’t set this up yet, but I think using an interface function will transfer the hit properties needed to play the right reaction.

This tutorial was helpful also.

I found another problem, and it’s with one attack triggering the hit states multiple times.

I have some “Notifies” in the attack animations, to set an active hit range for the move. Between frames so and so, this move can hit the enemy.

If I activate the collision for the attack at the start of that time frame, it will remain active even if it hits, and continue to register collisions, making the enemy go in to the hit state many times in rapid succession.

To fix that, I added “Component Begin Overlap” events to my Hit Volumes. Red collision spheres that can hit the enemy.

If the character is performing an attack, and one of these “Component Begin Overlap” Events is triggered, it will set a variable “Did I Hit Something?” to True, and in turn disable collision for all the Hit Volumes, even if the Active hit frames are not finished.

The reset for if anything was hit, is when an attack is triggered. Set “Did I Hit Something?” to False at the start of the attack.

The trigger for my attack, is a branch asking if that specific attack is in the Hit frames, and if It hasn’t hit anything, turn on collision. Otherwise, turn collision off.