|
CSGO: 3D Box ESP Source Code
int iScreenWidth, iScreenHeight; Vector min = coll->OBBMins(); Vector corners[8] = float ang = pEntity->GetEyeAngles()->y; for (int i = 0; i <= 7; i++) corners[i].Rotate2D(ang); Vector _corners[8]; for (int i = 0; i <= 7; i++) W2S(*pEntity->GetOrigin() + corners[i], _corners[i]); for (int i = 0; i <= 7; i++)
{
x0 = (int)(min(x1, _corners[i].x));
y0 = (int)(min(y1, _corners[i].y));
x1 = (int)(max(x1, _corners[i].x));
y1 = (int)(max(y1, _corners[i].y));
}
static Color col;
switch (*pEntity->GetTeamNum()) for (int i = 1; i <= 4; i++)
{
I::MatSurface()->DrawLine((int)(_corners[i - 1].x), (int)(_corners[i - 1].y), (int)(_corners[i % 4].x), (int)(_corners[i % 4].y)); And some fixed version: ICollideable* coll = Entity->GetCollideable(); Vector min = coll->OBBMins(); Vector corners[8] = float ang = Entity->GetEyeAngles().y; for (int i = 0; i <= 7; i++) corners[i].Rotate2D(ang); Vector _corners[8]; for (int i = 0; i <= 7; i++) D::WorldToScreen(Entity->GetOrigin() + corners[i], _corners[i]); int x1 = iScreenWidth * 2, y1 = iScreenHeight * 2, x2 = -iScreenWidth, y2 = -iScreenHeight; for (int i = 0; i <= 7; i++)
{
x1 = (int)(min(x1, _corners[i].x));
y1 = (int)(min(y1, _corners[i].y));
x2 = (int)(max(x2, _corners[i].x));
y2 = (int)(max(y2, _corners[i].y));
}
int diff = x2 - x1;
int diff2 = y2 - y1;
static Color col;
if (Entity->IsVisible(8)) for (int i = 1; i <= 4; i++) { D::DrawLine((int)(_corners[i - 1].x), (int)(_corners[i - 1].y), (int)(_corners[i % 4].x), (int)(_corners[i % 4].y), col); D::DrawLine((int)(_corners[i - 1].x), (int)(_corners[i - 1].y), (int)(_corners[i + 3].x), (int)(_corners[i + 3].y), col); D::DrawLine((int)(_corners[i + 3].x), (int)(_corners[i + 3].y), (int)(_corners[i % 4 + 4].x), (int)(_corners[i % 4 + 4].y), col); } |
|