To test if the LineTrace hit something or not, one could use the boolean returned by the method
LineTraceSingleByObjectType
documentation here
bool Hit = GetWorld()->LineTraceSingleByObjectType(
OUT HitResult,
PlayerViewPointLocation,
LineTraceEnd,
FCollisionObjectQueryParams(ECollisionChannel::ECC_PhysicsBody),
TraceParams
);
if (Hit)
{
FString HitName = HitResult.GetActor()->GetName();
UE_LOG(LogTemp, Warning, TEXT("We hit: %s"), *HitName);
}