In the function Vector CBot::AimPosition (void) You have this:
Code:
float fZComponentUpdate = UsesSniper () ? 15.0 : 17.0;
Vector vTarget = m_pentEnemy->v.origin;
if (g_rgpcvBotCVar[CVAR_HARDCOREMODE]->GetBool ())
fZComponentUpdate = (UsesSniper () ? 2.32 : UsesPistol () ? 5.0 : (fDistance < 300 ? 4.08 : 6.18)) + fZComponentUpdate;
else
fZComponentUpdate = fZComponentUpdate - (0.5 * (100.0 - m_iSkill)
(...)
// now take in account different parts of enemy body
if (m_ucVisibility & (VISIBLE_HEAD | VISIBLE_BODY)) // visible head & body
{
// now check is our skill match to aim at head, else aim at enemy body
if ((RandomLong (1, 100) < g_rgkSkillTab[m_iSkill / 20].iHeadshotFrequency) || UsesPistol ())
vTarget = vTarget + Vector (0, 0, fZComponentUpdate);
else
vTarget = vTarget;
}
else if (m_ucVisibility & VISIBLE_HEAD) // visible only head
vTarget = vTarget + Vector (0, 0, fZComponentUpdate);
The bot aims perfectly against the "normal size" bots or players, but it fails with the players/bots using some fun models - for example ChickenMod. The yabp is always trying to hit the head above real head of the chicken, which makes them impossible to hit an enemy.
You need to use
pEdict->v.view_ofs + {0,0,fZNewComponentUpdate} value instead of pEdict->v.origin + {0,0,fZComponentUpdate}.
fZNewComponentUpdate - the new offset for "Z" axis.