Hello, I am experiencing some weird behavior with my line tracing in c++.
I perform line trace as follows:
#define COLLISION_INTERACT ECC_GameTraceChannel2
FCollisionQueryParams TraceParams(SCENE_QUERY_STAT(InteractTrace), true, this);
GetWorld()->DebugDrawTraceTag = FName("InteractTrace");
FHitResult Hit(ForceInit);
FVector StartTrace = FirstPersonCameraComponent->GetComponentLocation();
FVector EndTrace = StartTrace + FirstPersonCameraComponent->GetForwardVector() * MAX_INTERACT_DISTANCE;
GetWorld()->LineTraceSingleByChannel(Hit, StartTrace, EndTrace, COLLISION_INTERACT, TraceParams);
AActor* HitActor = Hit.GetActor();
if (HitActor != nullptr) {
UE_LOG(LogTemp, Warning, TEXT("hit actor: %s"), *HitActor->GetName());
}
This is my engine collision settings, in Trace Channels I have defined InteractTrace, which should be set to ECC_GameTraceChannel2 in c++.
Moreover, I have created custom Object Channel named InteractTrigger, and preset InteractTrigger which should only block the InteractTrace channel and ignore everything else.
I created Blueprint with collision and expect to see it block the LineTrace that I cast.
However, the LineTrace passes right through it.
Now here’s the weird behavior:
When I change object response of my Blueprint BoxCollision against HitTrigger to block, It suddenly blocks the line trace:
and here is the result:
Can anyone please explain why changing response to one specific object channel affects response of my blueprint to trace channel? I am really at the end of my rope here, I also tried restarting, deleting the blueprint and the trace and object channels and my custom preset, but to no avail.
Thank you!