Help with LineTraceSingleByChannel

All of my code works until the DrawDebugPoint line is added to the if statment at which point it no longer seems to work which leads to issues when trying to set up a impact effect

This is the code it seems to match that which is in the video so im not sure whats going wrong

FVector Location;
FRotator Rotation;

OwnerController->GetPlayerViewPoint(Location, Rotation);

FVector End = Location + Rotation.Vector() * MaxRange;

//TODO Linetrace

FHitResult Hit;
bool bSuccess = GetWorld()->LineTraceSingleByChannel(Hit, Location, End, ECollisionChannel::ECC_EngineTraceChannel1);

if (bSuccess)
{
    DrawDebugPoint(GetWorld(), Hit.Location, 20, FColor::Red, true);
}   

Thanks

I’ve edited your post to use a code block. Please use it in the future.

As for what’s wrong, the only thing I see incorrect is using ECC_EngineTraceChannel1 instead of ECC_GameTraceChannel1

1 Like

Thanks that’s the issue solved I misread what was being used thanks for the help

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

Privacy & Terms