In void ATankgoPlayerController::AimTowardsCrosshair() you are calling the GetSightRayHitLocation() function with only 1 parameter specified when the function declaration requires two.
if (!GetControlledTank()) { return; }
FVector OutHitLocation; //Out parameter
if (GetSightRayHitLocation(OutHitLocation)) // No default parameters specific in function Definition
{
GetControlledTank()->AimAt(OutHitLocation);
}
}
I think this may be the formal parameter error message issue.
Ah, I see the problem, you take ScreenLocation as a parameter in the function GetSightRayHitLocation(FVector2D ScreenLocation, FVector& OutHitLocation).
You then redefine the ScreenLocation variable auto ScreenLocation = FVector2D(ViewportSizeX * CrosshairXLocation, ViewportSizeY * CrosshairYLocation);
That’s your formal redefinition. Remove the auto keyword or change the line auto ScreenLocation = FVector… to anything else that doesn’t conflict and it should successfully compile.
Ah, I see the problem, you take
ScreenLocation as a parameter in the
function
GetSightRayHitLocation(FVector2D
ScreenLocation, FVector&
OutHitLocation).
You then redefine the ScreenLocation
variable auto ScreenLocation =
FVector2D(ViewportSizeX
CrosshairXLocation, ViewportSizeY
CrosshairYLocation);
That’s your formal redefinition.
Remove the auto keyword or change the
line auto ScreenLocation = FVector…
to anything else that doesn’t conflict
and it should successfully compile. --Ryuuchi
Yeah, that got it, thanks. Its tough having to debug these out of date tutorials, but its good experience.