03_BattleTank/BattleTank/Source/BattleTank/Private/TankPlayerController.cpp
// GetWorldLocation of linetrace through crosshair	 , true if hit linescape		
GetWorldLocation of linetrace through crosshair         , true if hit linescape
GetWorldLocation of linetrace through crosshair true if hit linescape
bool ATankPlayerController::GetSightRayHitLocation(FVector & OutHitLocation) const
{
#pragma region Find crosshair position
	int32 ViewportSizeX, ViewportSizeY;
	GetViewportSize(ViewportSizeX, ViewportSizeY);
	FVector2D ScreenLocation = FVector2D(ViewportSizeX*CrossHairXLocation, ViewportSizeY* CrossHairYLocation); 
#pragma endregion
#pragma region "De-project" the screen position of the crosshair to a world direction
	FVector LookDirection;
	if (GetLookDirection(ScreenLocation, LookDirection)) {
		return GetLookVectorHitLocation(LookDirection, OutHitLocation);
	}
#pragma endregion
	return false;
}
bool ATankPlayerController :: GetSightRayHitLocation ( FVector & OutHitLocation ) const { #pragma  region Find crosshair position int32 ViewportSizeX , ViewportSizeY ; GetViewportSize ( ViewportSizeX , ViewportSizeY ) ; FVector2D ScreenLocation = FVector2D ( ViewportSizeX * CrossHairXLocation , ViewportSizeY * CrossHairYLocation ) ; #pragma  endregion #pragma  region "De-project" the screen position of the crosshair to a world direction FVector LookDirection ; if ( GetLookDirection ( ScreenLocation , LookDirection ) ) { return GetLookVectorHitLocation ( LookDirection , OutHitLocation ) ; } #pragma  endregion return false ; }
GetWorldLocation of linetrace through crosshair         , true if hit linescape
GetWorldLocation of linetrace through crosshair true if hit linescape
// Find the crosshair position /// auto is a new C++11 type that automatically sets the correct class type for you //UE_LOG(LogTemp, Warning, TEXT("ScreenLocation: %s"), *ScreenLocation.ToString()) // Line-trace alog that look direction, and see what we hit (up to max range) //UE_LOG(LogTemp, Warning, TEXT("Look Direction: %s"), *LookDirection.ToString()) // due to pythagoras theorem , the value, hypotamus is always one, therefore log Vectors does not appear more than 1 for Deprojecttoscreen	