Kisak-Strike icon indicating copy to clipboard operation
Kisak-Strike copied to clipboard

Fix incorrect bot aiming (they always aim at enemies' feet)

Open PiMoNFeeD opened this issue 3 years ago • 1 comments

for a long time I thought that the issue with that was related to some aim code they changed since CS:S, but then I decided to actually look at what the issue was and to my surprise, it turns out that Valve hardcoded hitbox IDs on models to then cache their position so bots can aim in that position, but since CS:S they did not update these IDs for CS:GO models respectively, so I fixed it and finally bots started giving headshots

game/server/cstrike/bot/cs_bot_vision.cpp: void CCSBot::ComputePartPositions( CCSPlayer *player ) change

	const int headBox = 12;
	const int gutBox = 9;
	const int leftElbowBox = 14;
	const int rightElbowBox = 17;

to

	const int headBox = 0;
	const int gutBox = 4;
	const int leftElbowBox = 16;
	const int rightElbowBox = 18;

since this old codebase still has support for the old animation system based on valvebiped skeleton, you can count for that too (it has been deprecated since 2015 so I doubt you would ever want to support it):

	const int headBox = m_bUseNewAnimstate ? 0 : 11;
	const int gutBox = m_bUseNewAnimstate ? 4 : 7;
	const int leftElbowBox = m_bUseNewAnimstate ? 16 : 13;
	const int rightElbowBox = m_bUseNewAnimstate ? 18 : 16;

if you're wondering, without this fix, instead of your head they always aim at your right ankle lol

PiMoNFeeD avatar Mar 13 '22 21:03 PiMoNFeeD

thx

nn-firc avatar Mar 14 '22 14:03 nn-firc