From ccec960a0d53a740eb546a9523811e066a5f118a Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 26 Oct 2026 16:46:37 +0100 Subject: Aimbot: fix eye height (m_vecViewOffset Z, not X); prefer head hitbox - g_cam_eye was adding the X component of m_vecViewOffset to Z, leaving the eye ~64 units too low; the aimbot consequently aimed above heads - head_position now prefers the HITGROUP_HEAD hitbox center before falling back to bone names (zombie: headcrab body hitbox) - log the exact head and desired angles for the first few aim ticks --- src/bones.cpp | 6 ++++++ src/esp.cpp | 12 +++++++++++- src/hl2h.cpp | 6 ++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/bones.cpp b/src/bones.cpp index f33a4b2..abcaac6 100644 --- a/src/bones.cpp +++ b/src/bones.cpp @@ -439,6 +439,12 @@ bool head_position(int idx, Vector &out) { const HitboxSet *s = hitbox_set0(e->hdr); if (s) { const Hitbox *boxes = hitboxes(s); + // HITGROUP_HEAD == 1. HL2 models often have no hitbox names, so use the + // damage-group head hitbox first (zombie: headcrab body, humanoids: head). + for (int i = 0; i < s->numhitboxes; i++) { + if (boxes[i].group == 1 && hitbox_world(e, boxes[i], out)) + return true; + } for (int i = 0; i < s->numhitboxes; i++) { if (boxes[i].bone < 0 || boxes[i].bone >= e->count) continue; diff --git a/src/esp.cpp b/src/esp.cpp index bd3fbdb..2987508 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -417,15 +417,25 @@ bool aimbot_apply(CUserCmd *cmd) { } // Refine to the actual head hitbox/bone for the chosen target only. + bool exact_head = false; void *best_ent = entitylist_get(best_idx); if (best_ent && bones_update(best_idx, best_ent)) { Vector head; if (head_position(best_idx, head) && - getfov(view, angle_to(g_cam_eye, head)) <= MAX_FOV) + getfov(view, angle_to(g_cam_eye, head)) <= MAX_FOV) { best_head = head; + exact_head = true; + } } QAngle desired = angle_to(g_cam_eye, best_head); + static int want_logs = 0; + if (want_logs < 10) { + want_logs++; + logf("aimbot: head=(%.1f %.1f %.1f) exact=%d want=%.2f/%.2f", + best_head.x, best_head.y, best_head.z, (int)exact_head, desired.x, + desired.y); + } float dp = desired.x - cmd->viewangles[0]; float dy = desired.y - cmd->viewangles[1]; while (dy > 180.0f) dy -= 360.0f; diff --git a/src/hl2h.cpp b/src/hl2h.cpp index de5d194..c3b94fe 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -200,8 +200,10 @@ static void do_move(int seq) { return; uintptr_t e = (uintptr_t)ent; - g_cam_eye = {*(float *)(e + g_net.origin), *(float *)(e + g_net.origin + 4), *(float *)(e + g_net.origin + 8)}; - g_cam_eye.z += *(float *)(e + g_net.viewoffset); + const float *vo = (const float *)(e + g_net.viewoffset); + g_cam_eye = {*(float *)(e + g_net.origin) + vo[0], + *(float *)(e + g_net.origin + 4) + vo[1], + *(float *)(e + g_net.origin + 8) + vo[2]}; g_cam_view = {cmd->viewangles[0], cmd->viewangles[1], cmd->viewangles[2]}; int flags = *(int *)(e + g_net.flags); bool onground = (flags & FL_ONGROUND) != 0; -- cgit v1.2.3