Since many People are asking them how to do external WorldToScreen in CSS, here i go:
typedef float ViewMatrix[ 16 ]; //Can be done different, i'm just using it like this
bool WorldToScreen( Vector from, Vector &to, ViewMatrix m_vMatrix )
to.x = m_vMatrix[ 0 ] * from.x + m_vMatrix[ 1 ] * from.y + m_vMatrix[ 2 ] * from.z + m_vMatrix[ 3 ];
to.y = m_vMatrix[ 4 ] * from.x + m_vMatrix[ 5 ] * from.y+ m_vMatrix[ 6 ] * from.z + m_vMatrix[ 7 ];
float w = m_vMatrix[ 12 ] * from.x + m_vMatrix[ 13 ] * from.y + m_vMatrix[ 14 ] * from.z + m_vMatrix[ 15 ];
if( w < 0.01f ) return false;
float invw = 1.0f / w;
to.x *= invw;
to.y *= invw;
float x = Resolution[ 0 ] / 2; // Resolution is my Global Variable which is holding the resolution of the game
float y = Resolution[ 1 ] / 2;
x += 0.5 * to.x * Resolution[ 0 ] + 0.5;
y -= 0.5 * to.y * Resolution[ 1 ] + 0.5;
to.x = x;
to.y = y;
But how to get to the WorldToScreenMatrix( m_vMatrix in my example above ) and use it?
//Before every WorldToScreen Call:
ReadProcessMemory( hlProc, LPCVOID( dwClientDLL + 0x54BE14 ), &dwTemp, 4, 0 );
ReadProcessMemory( hlProc, LPCVOID( dwTemp + 0x22C ), &W2SMatrix, sizeof( ViewMatrix ), 0 );
if( WorldToScreen( TargetPlayer->GetAbsOrigin( ), ScreenCoordinates, W2SMatrix ) )
Offsets are up2date, i may post them after updates here, but finding out, how to update them yourself should be better
Post Thanks / Like - 4 Thanks
Yeah, just different Offsets.
thanks for your code.
Do you have a tutorial or some hints how to find the WorldToScreenMatrix (i.e. in other games)?
This would be great.
World to screen is a math concept, its the same for all games.
Please, Correct me if im wrong but dont you just have the w2smatrix(3'rd param in the function) as your own position?
My own Position? Why should I use my own Position for the World2Screen?
Btw in this Code is a little Mistake with the Dll i'm reading the matrix out, it's not the client.dll, but the engine.dll.
Lol ye sorry I know I was pretty confused at the time, I know you dont need position for w2s its just that when Isaw 0x22C I knew that was the current position offset in the clocalplayer lol sorry for the inconvenience
Originally Posted by siM
The new Offsets:
Pointer: engine.dl + 0x58371C
Offset: Pointer + 0x2D4
Post Thanks / Like - 1 Thanks
I have some questions regarding implementation.
First of all, what is contained in the "To" and "From" parameters? I always thought To is the enemy's x,y,z coords and from is the players x,y,z coords.
Secondly, I have some programming questions, since I program in c# some of the code seems a bit peculiar to me.
From what I understand you make a float array with the length of 16.
Then you pass 16 as the buffer length to the readprocessmemory method. But usually readprocessmemory returns bytes and not floats. So do you actually get 16 real floats here or just bytes? And convert them to floats?
Needless to say if I want to retrieve 16 floats in c# i need to do 16 x 4 because each float consists of 4 bytes. Thats why this is so confusing to me.
also some values like the third index seem a bit arbitrary, when you retrieve these results do they look something like this? https://i.imgur.com/vyZNmXv.jpg
Looking forward to your replies I cant wait to finally get my esp done !
Vector from = enemys x,y,z
To = x,y Coordinates on Screen
ReadProcessMemory is taking the return value as a parameter, so depending on that, it will return the value. Because i use a Matrix of 16 Floats i have to change the size as well.