Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › MultiPlayer Game Hacks & Cheats › Call of Duty Hacks & Cheats › Call of Duty 6 - Modern Warfare 2 (MW2) Hacks › Call of Duty Modern Warfare 2 Coding / Programming / Source Code › Aimbot aiming in the wrong direction

QuestionAimbot aiming in the wrong direction

Posts 1–2 of 2 · Page 1 of 1
EX
exp111
Aimbot aiming in the wrong direction
Hey so game is pretty dead, but I still wanted to write some shitty code

Currently working on the aimbot but I'm probably doing the calculation wrong (just setting the viewangles to VectorAngles(delta))

Code:
Code:
Vector3 VectorAngles(const Vector3 forward)
{
	Vector3 angles = Vector3();
	float tmp, yaw, pitch;

	if (forward.x == 0 && forward.y == 0)
	{
		yaw = 0;

		if (forward.z > 0)
			pitch = 90.f;
		else
			pitch = 270.f;
	}
	else
	{
		yaw = RAD2DEG(atan2f(forward.y, forward.x));
		if (yaw < 0)
			yaw += 360;

		tmp = forward.Length2D();
		pitch = RAD2DEG(atan2f(forward.z, tmp));

		if (pitch < 0)
			pitch += 360;
	}

	angles.x = -pitch;
	angles.y = yaw;
	angles.z = 0;

	return angles;
}

Vector2 VectorToViewangles(Vector3 src, Vector3 dst)
{
	RefDef* refDef = Functions::GetRefDef();
	Vector3 vecEntity = Vector3();
	Vector3 vecAngle = Vector3();

	vecEntity = dst - src;
	vecAngle = VectorAngles(vecEntity);
	
	if (vecAngle.y > 180.0f)
		vecAngle.y -= 360.0f;
	else if (vecAngle.y < -180.0f)
		vecAngle.y += 360.0f;

	if (vecAngle.x > 180.0f)
		vecAngle.x -= 360.0f;
	else if (vecAngle.x < -180.0f)
		vecAngle.x += 360.0f;

	return Vector2(vecAngle.x, vecAngle.y);
}
And calling that in Draw2D hook:
Code:
if (closestPlayer != nullptr)
{
	void* font = Functions::RegisterFont(FONT_NORMAL, 1);
	ClientInfo* client = Functions::GetClientByIndex(closestPlayerNum);
	Functions::CmdDrawText(client->Name, font, 100, 375, Color::white);

	Vector3 headPos = Functions::GetBonePos(closestPlayer, Enums::Bones::HEAD);

	Vector3 eyePos = refDef->eyePos
	Vector2 angle = VectorToViewangles(eyePos, headPos);
	viewAngles->x = angle.x;
	viewAngles->y = angle.y;
}
ViewAngles = 0xBC7750 (can change them and they look right)
RefDef = 0x90B648
Code:
class RefDef
{
	char stub[8];
	int scrWidth;
	int scrHeight;
	Vector2 fov;
	Vector3 eyePos;
	Vector3 viewAxis[3];
	char stub2[16200];
	Vector3 rdViewAngles;
};
It sometimes locks to the sky or the exact opposite direction. Most of the time pitch is right but yaw fucks up.

Would be great if someone knew how to fix this
#1 · 7y ago
AV
avalanche33
The code looks right, I'll test it and report back
#2 · 5y ago
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

  • Am I heading in the wrong direction?By Mezmaa in Coders Lounge
    3Last post 10y ago
  • My Aimbot Starts Aiming At the Floor??By DjTapia( in Fortnite Discussion & Help
    2Last post 8y ago
  • Are there any working aimbots that aim at the head?By oooooooooo in CrossFire Hacks & Cheats
    9Last post 17y ago
  • sorry to put this in the wrong place butBy l3artt in WarRock - International Hacks
    14Last post 19y ago
  • Following The Wrong PathBy Haxors in General
    44Last post 19y ago

Tags for this Thread

None