Download

Want LineTraceSingleByChannel to ignore trigger volumes

Hello! It seems like this should be an easy fix and that I am just overlooking something simple, like a checkbox. I do not want the linetrace to hit trigger volumes.

FCollisionQueryParams Params;
Params.AddIgnoredActor(this);
Params.AddIgnoredActor(GetOwner());
return GetWorld()->LineTraceSingleByChannel(OUT Hit, ViewPortLocation, End, ECollisionChannel::ECC_GameTraceChannel1, Params);

Thank you!

You can add individual actors. This is an example of the ray trace ignoring the players own character:

FCollisionQueryParams rayTraceParameters(FName("Trace"), true);
rayTraceParameters.AddIgnoredActor(Cast<AActor>(_firstPersonCharacter));

For a larger scale solution use channels.

1 Like