From b37e1f6892895e438aa7974e1144a6269d94e4aa Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 26 Oct 2026 17:16:35 +0100 Subject: Aimbot v3: world-only vischeck - resolve EngineTraceClient003; TraceRay (slot 4) from the eye to the exact selected hitbox/bone point with MASK_VISIBLE - TRACE_WORLD_ONLY filter as requested (static props are not tested, per SDK) - Aimbot -> Vischeck toggle, persisted as vischeck=1; when on, blocked targets are skipped and the next-nearest candidate is tried - target candidates are ranked by angle; on each target the nearest visible selected hitbox point wins --- src/esp.cpp | 96 +++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 35 deletions(-) (limited to 'src/esp.cpp') diff --git a/src/esp.cpp b/src/esp.cpp index 57f67ae..2c033ea 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -358,9 +358,13 @@ bool aimbot_apply(CUserCmd *cmd) { hi = 4096; constexpr float MAX_FOV = 60.0f; // only things near the crosshair - float best_fov = MAX_FOV; - int best_idx = -1; - Vector best_head{}; + struct Candidate { + int idx; + float fov; + Vector approx; + }; + Candidate cands[16]; + int ncands = 0; for (int idx = 1; idx <= hi; idx++) { if (idx == local) @@ -394,14 +398,22 @@ bool aimbot_apply(CUserCmd *cmd) { Vector approx{origin.x, origin.y, origin.z + maxz * ((bone_mask & (1u << 1)) ? 0.9f : 0.55f)}; float fov = getfov(view, angle_to(g_cam_eye, approx)); - if (fov >= best_fov) + if (fov >= MAX_FOV) continue; - best_fov = fov; - best_idx = idx; - best_head = approx; + + // keep candidates sorted by approximate angle, nearest first + int pos = ncands; + while (pos > 0 && cands[pos - 1].fov > fov) + pos--; + if (ncands < 16) + ncands++; + for (int j = ncands - 1; j > pos; j--) + cands[j] = cands[j - 1]; + if (pos < 16) + cands[pos] = {idx, fov, approx}; } - if (best_idx < 0) { + if (ncands == 0) { static double last_none = 0.0; double now = esp_now(); if (now - last_none >= 2.0) { @@ -411,43 +423,57 @@ bool aimbot_apply(CUserCmd *cmd) { return false; } - static int sel_logs = 0; - if (sel_logs < 5) { - sel_logs++; - logf("aimbot: target idx=%d fov=%.2f eye=(%.1f %.1f %.1f) " - "approx_head=(%.1f %.1f %.1f)", - best_idx, best_fov, g_cam_eye.x, g_cam_eye.y, g_cam_eye.z, - best_head.x, best_head.y, best_head.z); - } - - // Refine to the nearest selected hitbox/bone point on the chosen target. - Vector pts[32]; - int npoints = 0; - void *best_ent = entitylist_get(best_idx); - if (best_ent && bones_update(best_idx, best_ent)) - npoints = aim_points(best_idx, bone_mask, pts, 32); - if (npoints <= 0) - return false; - float aim_fov = 1e9f; - Vector aim_pt{}; - for (int i = 0; i < npoints; i++) { - float f = getfov(view, angle_to(g_cam_eye, pts[i])); - if (f < aim_fov) { + // Walk targets nearest-first. On each, pick the nearest selected hitbox + // point that passes vischeck; skip to the next target if all are blocked. + int best_idx = -1; + Vector best_head{}; + for (int ci = 0; ci < ncands && best_idx < 0; ci++) { + int idx = cands[ci].idx; + void *ent = entitylist_get(idx); + if (!ent || !bones_update(idx, ent)) + continue; + Vector pts[32]; + int npoints = aim_points(idx, bone_mask, pts, 32); + float aim_fov = 1e9f; + Vector aim_pt{}; + for (int i = 0; i < npoints; i++) { + float f = getfov(view, angle_to(g_cam_eye, pts[i])); + if (f >= aim_fov) + continue; + if (aimbot_vischeck_enabled() && !is_visible(g_cam_eye, pts[i])) + continue; aim_fov = f; aim_pt = pts[i]; } + if (aim_fov <= MAX_FOV && aim_fov < 1e8f) { + best_idx = idx; + best_head = aim_pt; + static int sel_logs = 0; + if (sel_logs < 5) { + sel_logs++; + logf("aimbot: target idx=%d points=%d fov=%.2f vischeck=%d", idx, + npoints, aim_fov, (int)aimbot_vischeck_enabled()); + } + } } - if (aim_fov > MAX_FOV) + + if (best_idx < 0) { + static double last_vis = 0.0; + double now = esp_now(); + if (now - last_vis >= 2.0) { + last_vis = now; + logf("aimbot: no visible aim point (vischeck=%d)", + (int)aimbot_vischeck_enabled()); + } return false; - best_head = aim_pt; + } QAngle desired = angle_to(g_cam_eye, best_head); static int want_logs = 0; if (want_logs < 10) { want_logs++; - logf("aimbot: aim=(%.1f %.1f %.1f) points=%d fov=%.2f want=%.2f/%.2f", - best_head.x, best_head.y, best_head.z, npoints, aim_fov, desired.x, - desired.y); + logf("aimbot: aim=(%.1f %.1f %.1f) want=%.2f/%.2f", best_head.x, + best_head.y, best_head.z, desired.x, desired.y); } float dp = desired.x - cmd->viewangles[0]; float dy = desired.y - cmd->viewangles[1]; -- cgit v1.2.3