void Visuals::DrawHitboxMatrix(LagRecord* record, Color col, float time) { if (!g_menu.main.aimbot.debugaim.get()) return; const model_t* model; studiohdr_t* hdr; mstudiohitboxset_t* set; mstudiobbox_t* bbox; vec3_t mins, maxs, origin; ang_t angle; model = record->m_player->GetModel(); if (!model) return; hdr = g_csgo.m_model_info->GetStudioModel(model); if (!hdr) return; set = hdr->GetHitboxSet(record->m_player->m_nHitboxSet()); if (!set) return; for (int i{ }; i < set->m_hitboxes; ++i) { bbox = set->GetHitbox(i); if (!bbox) continue; // bbox. if (bbox->m_radius <= 0.f) { // https://developer.valvesoftware.com/wiki/Rotation_Tutorial // convert rotation angle to a matrix. matrix3x4_t rot_matrix; g_csgo.AngleMatrix(bbox->m_angle, rot_matrix); // apply the rotation to the entity input space (local). matrix3x4_t matrix; math::ConcatTransforms(record->m_bones[bbox->m_bone], rot_matrix, matrix); // extract the compound rotation as an angle. ang_t bbox_angle; math::MatrixAngles(matrix, bbox_angle); // extract hitbox origin. vec3_t origin = matrix.GetOrigin(); // draw box. g_csgo.m_debug_overlay->AddBoxOverlay(origin, bbox->m_mins, bbox->m_maxs, bbox_angle, col.r(), col.g(), col.b(), 3, time); } // capsule. else { // NOTE; the angle for capsules is always 0.f, 0.f, 0.f. // create a rotation matrix. matrix3x4_t matrix; g_csgo.AngleMatrix(bbox->m_angle, matrix); // apply the rotation matrix to the entity output space (world). math::ConcatTransforms(record->m_bones[bbox->m_bone], matrix, matrix); // get world positions from new matrix. math::VectorTransform(bbox->m_mins, matrix, mins); math::VectorTransform(bbox->m_maxs, matrix, maxs); g_csgo.m_debug_overlay->AddCapsuleOverlay(mins, maxs, bbox->m_radius, col.r(), col.g(), col.b(), col.a(), time, 1, 1); } } }