LineTraceSingle Does Not Work!

I used this tut: Unreal Engine C++ Tutorial - Making a gun! - YouTube But he has a older version of the engine.
Basicly in the part of the code:

	if (**GetWorld()->**LineTraceSingle****(HitResult, StartTrace, EndTrace, ECC_Visibility, *TracePrams)) {
		DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor::Green, false, 5.f);

		ATarget* TestTarget = Cast<ATarget>(HitResult->Actor.Get());

		if (TestTarget != NULL && !TestTarget->IsPendingKill()) {

			TestTarget->DamageTarget(50.f);
		}
	}

However the compiler in vs 2017 says: “LineTraceSingle” is not part of UWorld

Any feedback on a fix is appreciated!

Thanks in advance,

Propably what you want to use is UWorld::LineTraceSingleByChannel.

Another option would be to use the UKismetSystemLibrary, it’s basically the same, just remember to include the header if you use it, here is an example:

FHitResult HitResult;
TArray<AActor*> actorsToIgnore;

const FVector& ActorLocation = GetActorLocation();
if (UKismetSystemLibrary::LineTraceSingle(this, ActorLocation, ActorLocation + FVector(0.0f, 0.0f, -500.0f), UEngineTypes::ConvertToTraceType(ECC_Camera), false, actorsToIgnore, EDrawDebugTrace::None, HitResult, true, FLinearColor::Red, FLinearColor::Green, 0.0f))
{
	return HitResult.Location;
}