I’ve tried logging out everything already, from crosshair to look direction, start and end location. All of those work just fine. Then l tried log out Hit Location as in the picture but nothing came out. I think it’s because LineTrace always returns false. How can I fix this?
You can add a debug trace to see what’s going on
static FName TraceTag = TEXT("TraceTag");
FCollisionQueryParams Params(TraceTag);
GetWorld()->DebugDrawTraceTag = TraceTag;
if(GetWorld()->LineTraceSingleByChannel(
HitResult,
StartLocation,
EndLocation,
FCollisionChannel::ECC_Visibility,
Params)) // <- extra argument
//...
My, I see what happened, I tried what you told, it didn’t draw anything, which meant no trace were even there. Then I printed Hit Result, the start trace and end trace were the same. I let the End Vector be StartLocation. Silly me. Thank you for your help.
No problem
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.