**I have made identical SweepTraces for BP and C++ **
and
The BP returns every character inside sweep BUT the C++ version only returns self
and
for some reason the SweepMulti will only return the instigators HitResult NOT any other characters
TArray<FHitResult> OutHits;
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(OutHits, Start, End, FQuat::Identity, COQP, CS, Params))
{
int32 Segments = 1;
DrawDebugSphere(GetWorld(), Start, CS.GetSphereRadius(), Segments, FColor::Blue, true);
}
TArray<AShooterCharacter*> CharactersHit;
for (const FHitResult& ArrayElements : OutHits)
{
AShooterCharacter* HitCharac = Cast<AShooterCharacter>(ArrayElements.GetActor());
CharactersHit.AddUnique(HitCharac);
}
for (const AShooterCharacter* const ArrayElements : CharactersHit)
{
const FString& PlayerName = ArrayElements->GetActorLabel();
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Blue, FString::Printf(TEXT("character hit: %s"), *PlayerName));
}