How to use AActor::GetOverlappingActors?


I would like to create a capture flag area.
I am using a SphereComponent for the collision to delimitate the capture area.

I want to use AActor::GetOverlappingActors to get a list in a TArray of all the players inside the area, to check their quantity, their team, and define which team is capturing and at which speed.

But I have no idea how to use this function, the documentation did not really help me, and Epic deleted the wiki 4 days ago…


This is common practice to all of this kind of functions. If you have no return function on something that should return something and one of arguments is a reference (&), you need to declare local variable (but it can be declared anywher actullye) of that reference type and pass it to reference like this:

TArray<AActor*> Result;

Result array will be filled with actors that overlaps


Thanks a lot, it worked. :slight_smile:

Thanks :blush: