Basicaly we are using DotProduct function to consider aiming.
Code:
(...)
float flDot = GetShootingConeDeviation (pEdict, &vecEnemy);
if (flDot > 0.99)
{
pBot->bWantsToFire = TRUE;
}
(...)
float GetShootingConeDeviation (edict_t *pEdict, Vector *pvecPosition)
{
Vector vecDir = (*pvecPosition - GetGunPosition (pEdict)).Normalize ();
Vector vecAngle = pEdict->v.v_angle;
MAKE_VECTORS (vecAngle);
// He's facing it, he meant it
return (DotProduct (gpGlobals->v_forward, vecDir));
}
I hope that helps You.