Solved ESP not projecting properly

  • CSGO recently moved logic from 'client_panorama.dll' to 'client.dll', you must update all code that uses 'client_panorama.dll' and replace it with 'client.dll' or the code will not work.
Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

shey

Newbie
May 3, 2016
1
32
0
As you can see in the video I provided my ESP boxes are fucked up. Maybe the viewmatrix is not calculated properly, maybe the viewmatrix address is wrong or even the w2s function is wrong I simply don't know.
Viewmatrix address: 0x4A91254

W2S function:
C++:
bool w2s(float * from, float * to) 
{
 
    float w = 0.0f;
 
    to[0] = mlClient.w2sMatrix.flMatrix[0][0] * from[0] + mlClient.w2sMatrix.flMatrix[0][1] * from[1] + mlClient.w2sMatrix.flMatrix[0][2] * from[2] + mlClient.w2sMatrix.flMatrix[0][3];
    to[1] = mlClient.w2sMatrix.flMatrix[1][0] * from[0] + mlClient.w2sMatrix.flMatrix[1][1] * from[1] + mlClient.w2sMatrix.flMatrix[1][2] * from[2] + mlClient.w2sMatrix.flMatrix[1][3];
    w = mlClient.w2sMatrix.flMatrix[3][0] * from[0] + mlClient.w2sMatrix.flMatrix[3][1] * from[1] + mlClient.w2sMatrix.flMatrix[3][2] * from[2] + mlClient.w2sMatrix.flMatrix[3][3];
 
    if (w < 0.01f)
        return false;
 
    float invw = 1.0f / w;
    to[0] *= invw;
    to[1] *= invw;
 
    int width = 1280;
    int height = 1024;
 
    float x = (float)width / 2.0;
    float y = (float)height / 2.0;
 
    x += 0.5 * to[0] * width + 0.5;
    y -= 0.5 * to[1] * height + 0.5;
 
    to[0] = x;
    to[1] = y;
 
    return true;
}
 
Last edited by a moderator:

kXhashimoto

Jr.Coder
Full Member
Nobleman
Feb 19, 2016
54
278
2
As you can see in the video I provided my ESP boxes are fucked up. Maybe the viewmatrix is not calculated properly, maybe the viewmatrix address is wrong or even the w2s function is wrong I simply don't know.


Viewmatrix address: 0x4A91254

W2S function:
C++:
bool w2s(float * from, float * to) 
{
 
    float w = 0.0f;
 
    to[0] = mlClient.w2sMatrix.flMatrix[0][0] * from[0] + mlClient.w2sMatrix.flMatrix[0][1] * from[1] + mlClient.w2sMatrix.flMatrix[0][2] * from[2] + mlClient.w2sMatrix.flMatrix[0][3];
    to[1] = mlClient.w2sMatrix.flMatrix[1][0] * from[0] + mlClient.w2sMatrix.flMatrix[1][1] * from[1] + mlClient.w2sMatrix.flMatrix[1][2] * from[2] + mlClient.w2sMatrix.flMatrix[1][3];
    w = mlClient.w2sMatrix.flMatrix[3][0] * from[0] + mlClient.w2sMatrix.flMatrix[3][1] * from[1] + mlClient.w2sMatrix.flMatrix[3][2] * from[2] + mlClient.w2sMatrix.flMatrix[3][3];
 
    if (w < 0.01f)
        return false;
 
    float invw = 1.0f / w;
    to[0] *= invw;
    to[1] *= invw;
 
    int width = 1280;
    int height = 1024;
 
    float x = (float)width / 2.0;
    float y = (float)height / 2.0;
 
    x += 0.5 * to[0] * width + 0.5;
    y -= 0.5 * to[1] * height + 0.5;
 
    to[0] = x;
    to[1] = y;
 
    return true;
}
Try it like this

C++:
__forceinline bool WorldToScreen(Vector In, Vector& Out)
{
	Matrix3x4_t ViewMatrix = EngineClient->GetMatrix();
	Out.x = ViewMatrix.Matrix[0] * In.x + ViewMatrix.Matrix[1] * In.y + ViewMatrix.Matrix[2] * In.z + ViewMatrix.Matrix[3];
	Out.y = ViewMatrix.Matrix[4] * In.x + ViewMatrix.Matrix[5] * In.y + ViewMatrix.Matrix[6] * In.z + ViewMatrix.Matrix[7];
	Out.z = ViewMatrix.Matrix[12] * In.x + ViewMatrix.Matrix[13] * In.y + ViewMatrix.Matrix[14] * In.z + ViewMatrix.Matrix[15];
	if (Out.z < 0.01f) return false;
	float Inverse = 1.f / Out.z;
	Out.x *= Inverse;
	Out.y *= Inverse;
	int Width, Height;
	EngineClient->GetScreenSize(Width, Height);
	double X = Width / 2;
	double Y = Height / 2;
	X += 0.5 * Out.x * Width + 0.5;
	Y -= 0.5 * Out.y * Height + 0.5;
	Out.x = (float)X;
	Out.y = (float)Y;
	return true;
}
NP for spoonfeeding
 

Lukor

ded
Meme Tier VIP
Fleep Tier Donator
Dec 13, 2013
488
5,353
25
For me this just looks like wrong fov... if he aims right, the box is correct, getting further away will make them stretch to the outside.
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,099
78,998
2,373
The last 2 people that had this same problem is because they simply had the wrong addresses or offsets, I would double check all offsets and use kXhashimoto's world2screen. If both world2screen functions have the same effect then you have ruled out w2s as the problem :)
 
Attention! Before you post:

Read the How to Ask Questions Guide
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
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods