# SolvedCSGO ESP Box height not scaling properly at different distances

#### Salt_packet

Full Member
How long you been coding/hacking?
4 years coding / 3 months hacking
Coding Language
C++
Hello all, I have recently been working on my own CSGO external box esp and I've managed to get everything working so far.
The only issue is the height of the box that I'm using doesn't scale properly. Currently, this is what happens from far away:

and this is what happens from point-blank:

Here's a better overall picture:

Currently, I'm drawing boxes by iterating through the entity list and reading the m_vecOrigin for the base of the player and the head bone via m_dwBoneMatrix. More specifically, here's the code:
C++:
``````read(handle, LPC(entityBase + m_vecOrigin), &curr.pos, sizeof(curr.pos), 0); // regular xyz
read(handle, LPC(entityBase + m_dwBoneMatrix), &boneMatrix, sizeof(boneMatrix), 0);
My struct for curr.pos is just 3 floats (x,y,z) if you're confused.

Then, here's my world to screen function that I'm using to convert it:
C++:
``````struct espBox {
float x, y, w, h;
};

espBox r;

// do world to screen calc here with view matrix

r.x = centerX; // done calculation - don't worry about the x and y they're correct
r.y = centerY; // specifically, the x and y represent the head pos of the player

r.h = curr.head.z - curr.pos.z; // get the head pos - vec origin pos to get height
r.w = r.h / 2.f; // width is a ratio of the height

// in another function for drawing everything...
for (espBox r : players){
d3dfunctions.drawBox(r.x-(r.w/2), r.y, r.w, r.h);
}``````
I would assume that the issue with the boxes have the do with the fact that I'm not transforming the height with the view matrix but I'm not sure how to do it. I've looked online but more specifically, I followed this tutorial and at 4:40, it explains all the formulas needed for the world to screen function. I have a hunch that the thing I would need is z prime but I'm not sure. Any help would be appreciated.

My second issue is described by this forum post. I'm having the exact same issue where the box keeps on getting smaller and smaller when zooming in with the awp scope. Here are some pictures for reference.

I've already looked at the unknown cheats post and I'm not very sure I understand what one of the answers meant. It said to not calculate the height via distance but instead use w2s on head-pos and foot-pos but I'm not using distance in any of my calculations. Anyways, any help or pointers in the right direction is appreciated. Thanks.

#### bigtasty

Dank Tier Donator
Or you could use bounding boxes which work really well to keep them within the box.
Take a look at danielkrupinski/Osiris line 40

Attention! Before you post:

99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

• Fill out the form correctly
• Tell us the game name & coding language