diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-26 16:46:37 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-26 16:46:37 +0100 |
| commit | ccec960a0d53a740eb546a9523811e066a5f118a (patch) | |
| tree | 5df27448116c31ab9afee0c2270d44963ff82163 | |
| parent | Aimbot: push smoothed angles to engine view + diagnostics (diff) | |
| download | hl2h-ccec960a0d53a740eb546a9523811e066a5f118a.tar.gz hl2h-ccec960a0d53a740eb546a9523811e066a5f118a.zip | |
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
Diffstat (limited to '')
| -rw-r--r-- | src/bones.cpp | 6 | ||||
| -rw-r--r-- | src/esp.cpp | 12 | ||||
| -rw-r--r-- | 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) { | |||
| 439 | const HitboxSet *s = hitbox_set0(e->hdr); | 439 | const HitboxSet *s = hitbox_set0(e->hdr); |
| 440 | if (s) { | 440 | if (s) { |
| 441 | const Hitbox *boxes = hitboxes(s); | 441 | const Hitbox *boxes = hitboxes(s); |
| 442 | // HITGROUP_HEAD == 1. HL2 models often have no hitbox names, so use the | ||
| 443 | // damage-group head hitbox first (zombie: headcrab body, humanoids: head). | ||
| 444 | for (int i = 0; i < s->numhitboxes; i++) { | ||
| 445 | if (boxes[i].group == 1 && hitbox_world(e, boxes[i], out)) | ||
| 446 | return true; | ||
| 447 | } | ||
| 442 | for (int i = 0; i < s->numhitboxes; i++) { | 448 | for (int i = 0; i < s->numhitboxes; i++) { |
| 443 | if (boxes[i].bone < 0 || boxes[i].bone >= e->count) | 449 | if (boxes[i].bone < 0 || boxes[i].bone >= e->count) |
| 444 | continue; | 450 | 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) { | |||
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | // Refine to the actual head hitbox/bone for the chosen target only. | 419 | // Refine to the actual head hitbox/bone for the chosen target only. |
| 420 | bool exact_head = false; | ||
| 420 | void *best_ent = entitylist_get(best_idx); | 421 | void *best_ent = entitylist_get(best_idx); |
| 421 | if (best_ent && bones_update(best_idx, best_ent)) { | 422 | if (best_ent && bones_update(best_idx, best_ent)) { |
| 422 | Vector head; | 423 | Vector head; |
| 423 | if (head_position(best_idx, head) && | 424 | if (head_position(best_idx, head) && |
| 424 | getfov(view, angle_to(g_cam_eye, head)) <= MAX_FOV) | 425 | getfov(view, angle_to(g_cam_eye, head)) <= MAX_FOV) { |
| 425 | best_head = head; | 426 | best_head = head; |
| 427 | exact_head = true; | ||
| 428 | } | ||
| 426 | } | 429 | } |
| 427 | 430 | ||
| 428 | QAngle desired = angle_to(g_cam_eye, best_head); | 431 | QAngle desired = angle_to(g_cam_eye, best_head); |
| 432 | static int want_logs = 0; | ||
| 433 | if (want_logs < 10) { | ||
| 434 | want_logs++; | ||
| 435 | logf("aimbot: head=(%.1f %.1f %.1f) exact=%d want=%.2f/%.2f", | ||
| 436 | best_head.x, best_head.y, best_head.z, (int)exact_head, desired.x, | ||
| 437 | desired.y); | ||
| 438 | } | ||
| 429 | float dp = desired.x - cmd->viewangles[0]; | 439 | float dp = desired.x - cmd->viewangles[0]; |
| 430 | float dy = desired.y - cmd->viewangles[1]; | 440 | float dy = desired.y - cmd->viewangles[1]; |
| 431 | while (dy > 180.0f) dy -= 360.0f; | 441 | 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) { | |||
| 200 | return; | 200 | return; |
| 201 | 201 | ||
| 202 | uintptr_t e = (uintptr_t)ent; | 202 | uintptr_t e = (uintptr_t)ent; |
| 203 | g_cam_eye = {*(float *)(e + g_net.origin), *(float *)(e + g_net.origin + 4), *(float *)(e + g_net.origin + 8)}; | 203 | const float *vo = (const float *)(e + g_net.viewoffset); |
| 204 | g_cam_eye.z += *(float *)(e + g_net.viewoffset); | 204 | g_cam_eye = {*(float *)(e + g_net.origin) + vo[0], |
| 205 | *(float *)(e + g_net.origin + 4) + vo[1], | ||
| 206 | *(float *)(e + g_net.origin + 8) + vo[2]}; | ||
| 205 | g_cam_view = {cmd->viewangles[0], cmd->viewangles[1], cmd->viewangles[2]}; | 207 | g_cam_view = {cmd->viewangles[0], cmd->viewangles[1], cmd->viewangles[2]}; |
| 206 | int flags = *(int *)(e + g_net.flags); | 208 | int flags = *(int *)(e + g_net.flags); |
| 207 | bool onground = (flags & FL_ONGROUND) != 0; | 209 | bool onground = (flags & FL_ONGROUND) != 0; |
