Since upgrading the mortar and adding code to stop AI Tanks and exit player tank on death, the game has started crashing when the tank is hit. Here’s the Unreal crash window:
There’s a reference to TankPlayerController.cpp(50), which I assume means line 50 in the cpp file. Here’s that code (it’s the aim towards crosshairs section):
/void ATankPlayerController::AimTowardsCrosshair()
/{
/ auto AimingComponent = GetPawn()->FindComponentByClass();
/ if (!ensure(AimingComponent)) { return; }
/
/ FVector HitLocation; //Out parameter
/ bool bGotHitLocation = GetSightRayHitLocation(HitLocation);
/ //UE_LOG(LogTemp, Warning, TEXT(“bGotHitLocation: %i”), bGotHitLocation)
/
/ if (bGotHitLocation) //has side effect, is going to line trace
/ {
/ AimingComponent->AimAt(HitLocation);
/ }
/}
Line 50 is the one that begins “auto”.
Additionally, when camera is swapped to first person, I can’t aim the tank. The turret and barrel stay pointed straight ahead of the tank.
Anyone else having similar issues?