This is by design, the query system is confusing which is why we've introduced explicit functions instead of these crazy overloaded signature ones.
The collision channel specified in LineTraceSingleByChannel does not appear to be taken into account when the trace is performed. Instead of ignoring any objects that are not set to that channel, any object that is hit is returned.
The same behavior is observed in the current LineTraceSingle() function that is set to be deprecated in 4.8.
FVector CamLoc; FRotator CamRot; this->GetController()->GetPlayerViewPoint(CamLoc, CamRot); const FVector TraceDirection = CamRot.Vector(); FVector StartTrace = FVector::ZeroVector; FRotator UnusedRotation; this->GetController()->GetPlayerViewPoint(StartTrace, UnusedRotation); StartTrace = StartTrace + TraceDirection*((GetActorLocation() - StartTrace) | TraceDirection); const float TraceRange = 4096.f; const FVector EndTrace = StartTrace + TraceDirection * TraceRange; static FName TraceIdent = FName(TEXT("TheTrace")); FCollisionQueryParams TraceParams(TraceIdent, true, this); FHitResult TheHitResult; GetWorld()->LineTraceSingleByChannel(TheHitResult, StartTrace, EndTrace, ECC_WorldStatic, TraceParams);
RESULTS:
The hit result registers a hit for any line trace that hits a static mesh in the level, regardless of the collision channel that static mesh is set to.
EXPECTED:
The hit result registers a hit only for line traces that hit a static mesh with the collision channel set to ECC_WorldStatic.
Delay nodes occasionally don't fire the "Completed" output in a nativized build
Installer 4.10 failed with error code R-1603
I am not able to find world outliner how to enable it?
An error occurred while trying to generate project files !?
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
UE5.0.2 How to resolve error code (Xcode install) when trying to launch UE5.0.2 after install
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 4.7.6, 4.9 |
Created | May 5, 2015 |
---|---|
Resolved | May 6, 2015 |
Updated | Jul 14, 2021 |