From 621979bd9ca8107ffe848e46879d060a05b8dfc1 Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Sat, 31 Oct 2020 15:22:27 +0100 Subject: [PATCH] Fix aiming at buildings Render bounds stretch under the floor for some reason, and apparently those npcs do have proper hitboxes we can aim at, so do it --- src/hacks/Aimbot.cpp | 4 +--- src/helpers.cpp | 7 +------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 3829a6c2..ce66c79e 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -1142,9 +1142,7 @@ const Vector &PredictEntity(CachedEntity *entity) // NPCs (Skeletons, merasmus, etc) else if (entity->m_Type() == ENTITY_NPC) { - auto mins = RAW_ENT(entity)->GetCollideable()->OBBMins(); - auto maxs = RAW_ENT(entity)->GetCollideable()->OBBMaxs(); - result = RAW_ENT(entity)->GetCollideable()->GetCollisionOrigin() + (mins + maxs) / 2.0f; + result = entity->hitboxes.GetHitbox(std::max(0, entity->hitboxes.GetNumHitboxes() / 2 - 1))->center; } // Other else diff --git a/src/helpers.cpp b/src/helpers.cpp index 6d316699..dbc792d2 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -1075,12 +1075,7 @@ bool VisCheckEntFromEntVector(Vector startVector, CachedEntity *startEnt, Cached Vector GetBuildingPosition(CachedEntity *ent) { - // Get the collideable origin of ent and get min and max of collideable - // OBBMins and OBBMaxs are offsets from origin - auto raw = RAW_ENT(ent); - Vector min, max; - raw->GetRenderBounds(min, max); - return (min + max) / 2 + raw->GetCollideable()->GetCollisionOrigin(); + return ent->hitboxes.GetHitbox(std::max(0, ent->hitboxes.GetNumHitboxes() / 2 - 1))->center; } bool IsBuildingVisible(CachedEntity *ent)