Is there a way to get an information who started a collision?

Viewed 303

I have two actors in my project, sometimes AI Pawn is causing a collision and sometimes a Player is causing it. Is there a way to distinguish it?

2 Answers

Have you checked the onHit function for the AI Pawn and Player?

Both in C++ and Blueprint, collision events give you a FHitResult (displayed as just HitResult in BP). Here is reference.

This result contains both the Actor and Component that was hit/overlapped/traced.

So, the object calling the collision event is first object, and YourFHitResult.Actor is the other object.

In BP, you can use the break hit result node to get the actor/component.

Related