this SweepMultiByObjectType trace is only returning the owner character and not any other characters
TArray<FHitResult> HitResult;
FCollisionQueryParams Params;
FVector Start = GetRootComponent()->GetComponentLocation();
FVector End = Start + 0.1f;
FCollisionObjectQueryParams COQP;
COQP.AddObjectTypesToQuery(ECC_Pawn);
FCollisionShape CS;
CS.MakeSphere(1000.f);
if (GetWorld()->SweepMultiByObjectType(HitResult, Start, End, FQuat::Identity, COQP, CS, Params))
{
int32 Segments = 1;
DrawDebugSphere(GetWorld(), Start, 1000.f, Segments, FColor::Blue, true);
}
TArray<APlayerCharacter*> CharacterHitResult;
for (const FHitResult& LoopHitResult : HitResult)
{
APlayerCharacter* HitCharac = Cast<APlayerCharacter>(LoopHitResult.GetActor());
CharacterHitResult.AddUnique(HitCharac);
}
for (const APlayerCharacter* const ShooterChar : CharacterHitResult)
{
const FString& PlayerName = ShooterChar->GetActorLabel();
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Blue, FString::Printf(TEXT("character hit: %s"), *PlayerName));
}