Dont ask why i need this, i want to do external mouse aimbot.
The problem is that my cursor is spinning.
World to screen function
The problem is that my cursor is spinning.
World to screen function
Aimbot functionCode:BOOL world_to_screen(vec3& vec_world, vec3& vec_screen) { D3DXMATRIX matrix = memory::read<D3DMATRIX>(0xB6FA2C); if (matrix != NULL) { vec_screen.x = (vec_world.z * matrix._31) + (vec_world.y * matrix._21) + (vec_world.x * matrix._11) + matrix._41; vec_screen.y = (vec_world.z * matrix._32) + (vec_world.y * matrix._22) + (vec_world.x * matrix._12) + matrix._42; vec_screen.z = (vec_world.z * matrix._33) + (vec_world.y * matrix._23) + (vec_world.x * matrix._13) + matrix._43; double recip = (double)(1.0 / vec_screen.z); vec_screen.x *= (float)(recip * (vars::process_resolution.x)); vec_screen.y *= (float)(recip * (vars::process_resolution.y)); return TRUE; } return FALSE; }
Code:void main_thread() { while (TRUE) { Sleep(10); if (vars::aim_enable && is_window_active(vars::process_window)) { DWORD ped = memory::read<DWORD>(0xB6F5F0); if (ped != NULL) { DWORD ped_matrix = memory::read<DWORD>(ped + 0x14); vec3 ped_pos = { memory::read<float>(ped_matrix + 0x30), memory::read<float>(ped_matrix + 0x34), memory::read<float>(ped_matrix + 0x38) }; DWORD target = memory::read<DWORD>(ped + 0x79C); if (target != NULL) { DWORD target_matrix = memory::read<DWORD>(target + 0x14); vec3 target_pos = { memory::read<float>(target_matrix + 0x30), memory::read<float>(target_matrix + 0x34), memory::read<float>(target_matrix + 0x38) }; float target_health = memory::read<float>(target + 0x540); if (target_health > 0) { vec3 target_screen_pos = { 0, 0, 0 }; if (utils::world_to_screen(target_pos, target_screen_pos)) { if (GetAsyncKeyState(VK_RBUTTON) && vars::aim_mode == 1) { if (vars::debug) { std::cout << crypt(" [debug] target screen position: x=").decrypt() << target_screen_pos.x << crypt(" y=").decrypt() << target_screen_pos.y << crypt(" z=").decrypt() << target_screen_pos.z << std::endl; } mouse_event(MOUSEEVENTF_MOVE, target_screen_pos.x, target_screen_pos.y, 0, 0); } if (GetAsyncKeyState(VK_LBUTTON) && vars::aim_mode == 2) { if (vars::debug) { std::cout << crypt(" [debug] target screen position: x=").decrypt() << target_screen_pos.x << crypt(" y=").decrypt() << target_screen_pos.y << crypt(" z=").decrypt() << target_screen_pos.z << std::endl; } mouse_event(MOUSEEVENTF_MOVE, target_screen_pos.x, target_screen_pos.y, 0, 0); } } } } } } } }