How to add multiple actors to ignore while Linetracing

FCollisionQueryParams TraceParams(FName(TEXT("")), false, GetOwner());
GetWorld()->LineTraceSingleByObjectType(OUT ActorHit, PlayerViewPointLocation, LineTraceEnd,
FCollisionObjectQueryParams(ECollisionChannel::ECC_PhysicsBody), TraceParams
);

if (ActorHit.GetActor())
{
	UE_LOG(LogTemp, Warning, TEXT("Actor that I am hitting is %s"), *ActorHit.GetActor()->GetName());
}

}

How can I add multiple actors to ignore list like we are ignoring GetOwner() here.
Is there a better way to do this working with multiple actors eg: have a certain type of tower in my game attack a certain type of Actor/Hero only. So I can create booleans or Actor Array but what should I do exactly

Use one of the functions on FCollisionQueryParams

Thanks it worked… Also if my linetracing does not start from the Actor how can we remove GetOwner() from

FCollisionQueryParams TraceParams(FName(TEXT("")), false, GetOwner());

as we have to pass in some actor… Can we simply say AActor here and leave it…

Update : Oh I think we can use different constructor given here https://docs.unrealengine.com/en-US/API/Runtime/Engine/FCollisionQueryParams/index.html

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms