1
\$\begingroup\$

The signature it takes is

void ( AActor* OtherActor )

However, The actor that is handling this event is not involved in the overlap. How can I access the actor that owns this delegate? Assuming I can't store a reference to this elsewhere. Is there another delegate that takes that parameter? Is this reference stored in OtherActor somewhere?

\$\endgroup\$
2
\$\begingroup\$

Irritatingly, I don't believe there isn't a simple way (which is why most events in other frameworks have a sender parameter...). Instead, one way I've worked around is:

Bind to the collision event inside the actor that has the UPrimitiveComponent you want to listen to.

Create an event in that actor that others can subscribe to. But this event has the signature void (AActor* OtherActor, AActor* Sender).

When the first event is triggered, simply fire the other event, filling in this as the second parameter.

This also works in BP using event dispatchers.

\$\endgroup\$
  • \$\begingroup\$ This workaround is a crap, but I'm not saying that you did any wrong, I mean Unreal should definitely add a sender. By the way, I also uses this workaround now... \$\endgroup\$ – Marson Mao Jan 27 '16 at 4:02
0
\$\begingroup\$

The actor that is firing the event is the current instance:

(this-> ) Will get you the actor that is firing the event.

(OtherActor-> ) Will get you the actor that it collided with.

\$\endgroup\$
  • \$\begingroup\$ Like I said, the actor that is handling the event has nothing to do with the overlap. \$\endgroup\$ – Ben Mar 21 '15 at 14:22
  • \$\begingroup\$ How does it have nothing to do with the overlap? It has to overlap with something in order to fire the delegate. \$\endgroup\$ – Steve Mar 21 '15 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.