void ATankPlayerController::AimTowardsCrosshair() { if (!GetPawn()) { return; } // e.g. if not possessing auto AimingComponent = GetPawn()->FindComponentByClass<UTankAimingComponent>(); if (!ensure(AimingComponent)) { return; } FVector HitLocation; // Out parameter bool IsLocationHit = GetSightRayHitLocation(HitLocation); if (GetSightRayHitLocation(HitLocation)) // Has "side-effect", is going to line trace { AimingComponent->AimAt(HitLocation); } }
void ATankPlayerController::AimTowardsCrosshair() { if (!GetControlledTank()) return; FVector HitLocation; if (GetSightRayHitLocation(HitLocation)) { GetControlledTank()->AimAt(HitLocation); } }
void ATankPlayerController::AimTowardsCrosshair() { if (!GetPawn()){ return; } FVector HitLocation = FVector(0); //OUT parameter if (GetSightRayHitLocation(HitLocation)) { GetPawn()->FindComponentByClass<UTankAimingComponent>()-> AimAt(HitLocation); } }
void ATankPlayerController::AimTowardsCrosshair() { if (!GetControlledTank()) { return; } FVector HitLocation; if (GetSightRayHitLocation(HitLocation)) { GetControlledTank()->AimAt(HitLocation); } // If it hits the landscape // Tell conctrolled tank to aim at this point }
void ATankPlayerController::AimTowardsCrosshair() { if (!GetPawn()) { return; }//e.g. if not possessing auto AimingComponent = GetPawn()->FindComponentByClass<UTankAimingComponent>(); if (!ensure(AimingComponent)) { return; } FVector HitLocation;// Out parameter bool bGotHitLocation = GetSightRayHitLocation(HitLocation); if (bGotHitLocation) { AimingComponent->AimAt(HitLocation); } }
void ATankPlayerController::AimTowardsCrosshair() { if (!GetPawn()) { return; } auto AimingComponent = GetPawn()->FindComponentByClass<UTankAimingComponent>(); if (!ensure(AimingComponent)) { return; } FVector HitLocation; // OUT parameter bool bGotHitLocation = GetSightRayHitLocation(HitLocation); if (bGotHitLocation) { // Tell controlled tank to aim at this point AimingComponent->AimAt(HitLocation); } }
void ATankPlayerController::AimTowardsCrosshair() const { // If we don't have a controlled tank, return. if (!GetPawn()) return; auto AimingComponent = GetPawn()->FindComponentByClass<UTankAimingComponent>(); if (!ensure(AimingComponent)) { return; } FVector HitLocation; // OUT parameter bool bGotHitLocation = GetSightRayHitLocation(HitLocation); if(bGotHitLocation) { AimingComponent->AimAt(HitLocation); } }
void ATankPlayerController::AimTowardsCrosshair() { if (!GetControlledTank()) { return; } FVector HitLocation; // Out parameter if (GetSightRayHitLocation(HitLocation)) { GetControlledTank()->AimAt(HitLocation); return; } // Has "side-effect", is going to line trace // Get world location of linetrace through crosshair // If it hits the landscape // Tell the controlled tank to aim at this point }
void ATankPlayerController::AimTowardsCrosshair() { if (!GetControlledTank()) { return; } FVector HitLocation; if (GetSightRayHitLocation(HitLocation)) { GetControlledTank()->AimAt(HitLocation); } else { //UE_LOG(LogTemp, Warning, TEXT("No hit found")); } //raycast to world //if it hits the landscape, aim at the point of intersection //UE_LOG(LogTemp, Warning, TEXT("PlayerController AimTowardsCrosshair()")); }