Using the same variable name is confusing

Using HitLocation both as the outparameter and the local variable in GetSightRayLocation seems like bad form.

	FVector HitLocation; //outparam
 if (GetSightRayHitLocation(HitLocation))
 {
	 UE_LOG(LogTemp, Warning, TEXT("HitLocation: %s"), *HitLocation.ToString());
	 //aim there
 }
return;
}

bool ATankPlayerController::GetSightRayHitLocation(FVector& hitloc) const
{
	hitloc = FVector(3.0,2.0,1.0);
	return true;
}

Privacy & Terms