SweepMultiByObjectType only returning owner

anonymous_user_09f3abfc
Sat, 12 Sep 2020 10:47:31 +0000
World Creation

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));
}

2 posts - 1 participant