nbenven95 / BattleTank

Second major project in the Udemy Unreal Engine 4 course (project is actually C++, github seems to have goofed)
0 stars 0 forks source link

AI Tanks only shoot when far away #24

Open nbenven95 opened 5 years ago

nbenven95 commented 5 years ago

The reason this happens is because the AI tank needs to get a lock on the player tank. If the projectile velocity is too high and/or the player tank is too close, SuggestProjectileVelocity won't be able to find an aim solution and the AI tank can't get a lock on the player. Another contributing factor is that the root of the player tank that the AI aims at is very low to the ground, making it difficult for an aim solution to be found. There are two possible solutions to this:

or

Another option would be to look at how IsBarrelMoving() works. The issue is that the AI tank thinks their barrel is moving when the player is too close because this method fails because SuggestProjectileVelocity can't find an aim solution when the player is up too close.