Solved Csgo ESP WorldToScreen Problem.

  • 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

fluggums

Newbie
Aug 12, 2014
4
167
1
I'm having a few problems with an ESP I'm making based mostly off of Fleep's ESP GUI tutorial using a directx overlay.
The current view matrix address I'm using is: 0x4A058D4.

I'm able to get the Player's and enemies' positions, but trying to project the 3d coordinates onto the 2d screen results in junk values with my DrawLine function drawing lines that lead off to random X,Y coordinates on my screen.
I'm using the WorldtoScreen Function from the ESP tutorial to try to get the correct 2d projections but am unsure whether the function is not working or I'm supplying it with the wrong values.
I'm getting the 4x4 W2S matrix with: ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + 0x4A058D4), &W2S_M, sizeof(W2S_M), 0); in my Player_Info class.

C++:
bool WorldToScreen(float * from, float * to)
{
    to[0] = Player_A.W2S_M.flMatrix[0][0] * from[0] + Player_A.W2S_M.flMatrix[0][1] * from[1] + Player_A.W2S_M.flMatrix[0][2] * from[2] + Player_A.W2S_M.flMatrix[0][3];
    to[1] = Player_A.W2S_M.flMatrix[1][0] * from[0] + Player_A.W2S_M.flMatrix[1][1] * from[1] + Player_A.W2S_M.flMatrix[1][2] * from[2] + Player_A.W2S_M.flMatrix[1][3];

    float w = Player_A.W2S_M.flMatrix[3][0] * from[0] + Player_A.W2S_M.flMatrix[3][1] * from[1] + Player_A.W2S_M.flMatrix[3][2] * from[2] + Player_A.W2S_M.flMatrix[3][3];

    if (w < 0.01f)
        return false;

    float invw = 1.0f / w;
    to[0] *= invw;
    to[1] *= invw;

    int width = (int)(tSize.right - tSize.left);
    int height = (int)(tSize.bottom - tSize.top);

    float x = width / 2;
    float y = height / 2;

    x += 0.5 * to[0] * width + 0.5;
    y -= 0.5 * to[1] * height + 0.5;

    to[0] = x + tSize.left;
    to[1] = y + tSize.top;

    return true;
}

I've been stuck with this problem for the past few days and was wondering if anyone had any hints or tips that could point me towards the right direction?
 
Last edited by a moderator:

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
first of all, use imgur for uploading pictures, staff seems to be busy all the time hmm
 

simonpaa

Jr.Coder
Silenced
Oct 2, 2013
55
708
0
Try to do :
C++:
bool W2Sc(vec3_t from, float to[2])
And "re-code" all your math you tried to use.

If u not know so much about vector/vec3_t you can just c&p this :
C++:
typedef float vec_t;
typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];

Remember
C++:
#include <vector>
:eek:
 
Last edited:

dmo

Coder
Full Member
Nobleman
Nov 8, 2014
145
678
5
C++:
BOOL ESP::W2S(float * from, float * to){
	to[0] = mMatrix.pMatrix[0][0] * from[0] + mMatrix.pMatrix[0][1] * from[1] + mMatrix.pMatrix[0][2] * from[2] + mMatrix.pMatrix[0][3];
	to[1] = mMatrix.pMatrix[1][0] * from[0] + mMatrix.pMatrix[1][1] * from[1] + mMatrix.pMatrix[1][2] * from[2] + mMatrix.pMatrix[1][3];
	float w = mMatrix.pMatrix[3][0] * from[0] + mMatrix.pMatrix[3][1] * from[1] + mMatrix.pMatrix[3][2] * from[2] + mMatrix.pMatrix[3][3];

	if (w < 0.01f)
		return false;

	float invw = 1.0f / w;
	to[0] *= invw;
	to[1] *= invw;

	RECT rect = { 0, 0, ESPWindow::Inst().Width, ESPWindow::Inst().Height }; //this is the game size/directx size
	int width = rect.right - rect.left;
	int height = rect.bottom - rect.left;

	float x = (float)(width / 2);
	float y = (float)(height / 2);

	x += (int)(0.5 * to[0] * width + 0.5);
	y -= (int)(0.5 * to[1] * height + 0.5);

	to[0] = x + rect.left;
	to[1] = y + rect.top;

	return TRUE;

}


float xy[3];
float enemyPos[3];

if (ESP::Inst().W2S(enemyPos, xy)
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,187
12,638
76
Remember
C++:
#include <vector>
:eek:
vector.h from stl has nothing to do with the code you or OP posted unfortunately; its a resizable array of items not a vector as a mathematical concept.

I recommend building your own header for your own vector class or use D3DXVECTORX from dx.
 
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