Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PiMoNFeeD opened this issue Mar 13, 2022 · 1 comment
Open

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

PiMoNFeeD opened this issue Mar 13, 2022 · 1 comment

Comments

@PiMoNFeeD
Copy link

PiMoNFeeD commented Mar 13, 2022

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

@nn-firc
Copy link

nn-firc commented Mar 14, 2022

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants