This is my code
FHitResult* hitResult = new FHitResult();
FVector StartTrace = Player->GetActorLocation();
FVector EndTrace = CoverSpotsInOrder[i]->GetActorLocation();
//FCollisionQueryParams* TraceParams = new FCollisionQueryParams();
if (GetWorld()->LineTraceSingleByChannel(*hitResult, StartTrace, EndTrace, ECC_Visibility))
{
DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor(255.0, 0, 0), true);
UE_LOG(LogTemp, Warning, TEXT("CoverSystem %s"), *hitResult->Actor->GetName());
if (hitResult->Actor->GetName() != "Player")
{
//GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Red, FString::Printf("You hit %s", hitResult->Actor->GetName()));
temp = CoverSpotsInOrder[i];
CoverSpotsInOrder.Empty();
return temp;
}
}
Unfortunately, the line trace goes through all objects straight to Player. I have the collision settings on all objects set to BlockAll. Any idea whats wrong?