Optimizing firing further

Over on the discord server, Skyshaver and I were discussing how to implement an additional feature to make AI firing more natural. We came up with this…

FiringDistance = AIPawn->GetDistanceTo(PlayerPawn);//Ensures the AI only fires when in a certain distance of the player

and

		if (AimingComponent->GetFiringState() == EFiringState::Locked && FiringDistance < 9000.)
		{
			AimingComponent->Fire();
		}

this keeps the AI enemy from firing at you from across the map. I put 5 enemies on my map and it was getting a little overwhelming to constantly have all five enemies firing at you at once.

1 Like

Privacy & Terms