Hello, my ESP is not aligning properly to the body when I'm far away, however if I get closer or use an AWP scope, the ESP gets back in the proper place. I'm using a D3D overlay with this external cheat made in C#.

Here's what I mean.

Close range
ESP off set from body in far ranges in Counterstrike Global Offensive

Far range
ESP off set from body in far ranges in Counterstrike Global Offensive

Some of my code that might be the issue

ESP
Code:

if (Reliant.Me.Id == entity.Id || entity.State != 6 || entity.Dormant) continue;

var screenPos = WorldToScreen(entity.Position);
var headPos = WorldToScreen(entity.BoneMatrix.Position(10));

if (screenPos == null || headPos == null) continue;

var height = Math.Abs(screenPos.Value.Y - headPos.Value.Y);
var width = height / 2;

var color = DH.Color(entity.Team == Reliant.Me.Team ? "00ffff" : "00ff00"); // DH.Color just converts color code to Color

DF.DrawBox(screenPos.Value.X - (width / 2), screenPos.Value.Y - height, width, height, 1, color); // DrawBox on x, y, width, height, linewidth, color

W2S
Code:

private readonly float[] viewMatrix = new float[16];

Code:

for (var i = 0; i < 16; i++)
viewMatrix[i] = Reliant.Memory.Read(Reliant.ClientBase + (int)Base.ViewMatrix + (i * 0x4));

Code:

private Vector2? WorldToScreen(Vector3 vectFrom)
{
var vect = new Vector2
{
X = viewMatrix[0] * vectFrom.X + viewMatrix[1] * vectFrom.Y + viewMatrix[2] * vectFrom.Z + viewMatrix[3],
Y = viewMatrix[4] * vectFrom.X + viewMatrix[5] * vectFrom.Y + viewMatrix[6] * vectFrom.Z + viewMatrix[7]
};

var w = viewMatrix[12] * vectFrom.X + viewMatrix[13] * vectFrom.Y + viewMatrix[14] * vectFrom.Z + viewMatrix[15];

if (w < 0.1f) return null;

var invW = 1.0f / w;
vect.X *= invW;
vect.Y *= invW;

var width = Reliant.Rect.right; // (1920)
var height = Reliant.Rect.bottom; // (1080)

vect.X = width / 2 + (0.5f * vect.X * width + 0.5f);
vect.Y = height / 2 - (0.5f * vect.Y * height + 0.5f);

return vect;
}




Original Writen by pawd1 in Counterstrike Global Offensive Category, the date of 26-06-2015 19:42.