Similar to #2171, there's currently no way to override the GetEyePosition for Nextbots. It returns the WorldSpaceCenter as the eye position and having this change would make Visible, VisibleVec, IsLineOfSightClear, IsAbleToSee, and the vision interface (IVision) useful again.
I would propose adding a Vector m_eyeOffset; to the CLuaNextBotBody class and then overriding this method:
CLuaNextBot::Spawn()
{
BaseClass::Spawn();
...
// default in IBody::GetEyePosition()
GetBodyInterface()->m_eyeOffset = WorldSpaceCenter() - GetAbsOrigin();
// ENT:Initialize down here
}
And to set and get the eye offset, you could add methods like NEXTBOT:SetEyeOffset and NEXTBOT:GetEyeOffset. Devs can then set the eye offset in ENT:Initialize.
Details
Similar to #2171, there's currently no way to override the
GetEyePosition
for Nextbots. It returns theWorldSpaceCenter
as the eye position and having this change would makeVisible
,VisibleVec
,IsLineOfSightClear
,IsAbleToSee
, and the vision interface (IVision
) useful again.I would propose adding a
Vector m_eyeOffset;
to theCLuaNextBotBody
class and then overriding this method:Then:
And to set and get the eye offset, you could add methods like
NEXTBOT:SetEyeOffset
andNEXTBOT:GetEyeOffset
. Devs can then set the eye offset inENT:Initialize
.This approach is based on TF2 for the
CBotNPCArcher
. See here: https://github.com/lua9520/source-engine-2018-hl2_src/blob/3bf9df6b2785fa6d951086978a3e66f49427166a/game/server/tf/bot_npc/bot_npc_archer.h and https://github.com/lua9520/source-engine-2018-hl2_src/blob/3bf9df6b2785fa6d951086978a3e66f49427166a/game/server/tf/bot_npc/bot_npc_archer.cpp