Quote:
Originally Posted by Pierre-Marie Baty
why so complicated, guys ?
Code:
// is enemy looking at more than 90° aside of the bot's forward direction ?
if (fabs (WrapAngle (pEnemyEdict->v.v_angle.y - pBotEdict->v.v_angle.y)) > 90)
{
// yes, it is (meaning, bot sees the back of its enemy)
}
else
{
// no, it is not (enemy is facing the bot)
}

|
2 minor bugs with this approach:
1. The shield protection yaw angle is closer to 120 degrees than 180 so you would probably get better results using 60 instead of 90 in the code above.
2. If the enemy with the shield is not crouched, you can shoot at his feet and take him out that way. So a better algorithm would be something like this:
If enemy is facing within 60 degrees of directly at you then
CircleBehindEnemy
If EnemyIsNotCrouched then
ShootAtEnemy'sFeetWhileCirclingBehindHim
EndIf
Else
BlastTheBastardsFaceOff
EndIf