Download

2 Way Hit Collision

I made a CustomActor class that inherits from Actor, from which I created 3 more classes. On The CustomActor class I am using the Hit Event to call ApplyDamage.

e2b57b9c308703e34168d81062b20e7f8c83a245.png

On each actor I have added a custom TakeDamage Blueprint Component.

88ad946e4ee48dcbdd97af9f1e7d82d29823ea70.png

When the actors hit each other, one of them is removed, but the other is not. It is as if one actor is being removed before the other one realizes that it is being hit or the Hit test is not working both ways. Simulation Generates Hit Events is Enabled for all and the Collision Preset is PhysicsActor. What am I doing wrong?

Thank You,
Ryan

(Sorry, my phone cant display the blueprints in your link…)

Have you tried adding a short delay before destroying the actors?

If you haven’t done so already, you should also probably have the code to destroy/remove/damage an actor exist inside THAT actor. This prevents weird bugs where another actor kills something before that something can do its thing.

I have changed the links to screenshots. I have not tried a delay, but that doesn’t seem right. The code for the damage/destroy is on each actor as a blueprint component.

Have you verified that the actor isnt being destroyed before it registers a hit event on the other actor? Is it always the same actor that vanishes?

Because youre right. It all seems like the actor is being destroyed before it can register a hit on the other. Hence my delay suggestion.

I will definitely try the delay. Thanks for the suggestion! I still feel like the hit event should call on each when the hit occurs and then each component should run the event script and go from there.

Update us how you solve the problem. Seems like something I’ll likely run into the future and it would be great having a solution in the pocket :slight_smile:

I cannot use delay because it is just delaying the same functionality. I added it before calling apply damage so I know the delay occurs right after the Hit Event and right before the actors receive the event.

The actor that instigated the hit needs to be set invisible with a delay until the other actor has a chance to run its code I would thinK. Or possibly in is both if you need to. Run your code and then destroy the actors.