I am trying to find all actors of a Worker class I created derived from ACharacter within a certain radius using the following code:
if (World)
{
TArray<struct FOverlapResult> Overlaps;
if (World->OverlapMultiByObjectType(Overlaps, GetWorldLocationOfCubeCenter(CubeToRemove),
FQuat::Identity, FCollisionObjectQueryParams(ECC_Pawn), FCollisionShape::MakeSphere(10000.0f), FCollisionQueryParams()))
{
for (auto& Object : Overlaps)
{
// do stuff
}
}
}
In the blueprint for the Worker class, I have “Generate Overlap Events” selected under “Capsule Component.” I have tried using a collision preset on the worker of Pawn, and have also tried using a custom collision profile in which overlap is selected for all collision responses, but World->OverlapMultiByObjectType always returns false. I would appreciate any suggestions on what I might be doing wrong.