Official site anti-cheat Ultra Core Protector

Home Download F.A.Q. Addons Monitor Forum Support Advertise English version site UCP Anti-Cheat  Russian version site UCP Anti-Cheat
Ultra Core Protector - is the client-server anti-cheat freeware, for server protection from unscrupulous players.

Abilities Supported games  
Half-Life
Condition Zero
Counter-Strike 1.6
Day of Defeat
Adrenaline Gamer
Team Fortress Classic
Counter-Strike Source
MU Online
Ragnarok Online
Half-Life 2 Deathmatch
Adrenaline Gamer 2
Team Fortress 2
CSGO: Viewmatrix Worldtoscreen trouble

Hi, I’ve been working on my C# external cheat but have run into several issues in regards to the viewmatrix worldtoscreen, I will go into detail into what I’m doing to attempt to read the viewmatrix and the strange results I am getting

The way i am going about the viewmatrix is taking the viewmatrix values from memory, putting them into a float array of size 16, then running the worldtoscreen method on the 3 coordinates of each player.

First of all I am populating the float array I use for the viewmatrix using this method I iterate through each address and set the address read to the current
iteration in the array.

for (int i = 0; i < 16; i++) { int offs = i * 0x4; float value = readfloatfrommem(enginedllmemoryaddress + viewmatrixaddress + i); viewmatrixarray[i] = value; }

I'm then using my float array inside my worldtoscreen method, (I had to look how to do this one beforehand as I have no previous experience with a transformation matrix).

float[] worldtoscreen(float posx, float posy, float posz)
{
float[] returncoords = new float[2];
float w = 0.0f;

returncoords[0] = viewmatrixarray[0] * posx + viewmatrixarray[1] * posy + viewmatrixarray[2] * posz + viewmatrixarray[3];
returncoords[1] = viewmatrixarray[4] * posx + viewmatrixarray[5] * posy + viewmatrixarray[6] * posz + viewmatrixarray[7];
w = viewmatrixarray[12] * posx + viewmatrixarray[13] * posy + viewmatrixarray[14] * posz + viewmatrixarray[15];

if (w < 0.01f) return null; float invw = 1.0f / w; returncoords[0] *= invw; returncoords[1] *= invw; // Change these asap. int width = 1920; int height = 1080; float x = width / 2; float y = height / 2; x += 0.5f * returncoords[0] * width + 0.5f; y -= 0.5f * returncoords[1] * height + 0.5f; returncoords[0] = x; returncoords[1] = y; return returncoords; }

I then run my worldtoscreen method through each of the players. Before putting the coords through the function I call the readviewmatrix method to ensure it's updated.

One thing it isn't is the coordinates, I have checked that I am getting the player coordinates correctly and I am they are the right positions,, the X Y and Z are correct as input but the output I am getting is completely bogus and is totally outside the values of the screen.

Example output
VMATRIX: Entity number 1 viewmatrix values 4.58586E+17 539.5
VMATRIX: Entity number 0 viewmatrix values 478.3407 539.5
VMATRIX: Entity number 1 viewmatrix values 478.3407 539.5
VMATRIX: Entity number 0 viewmatrix values 960.5 539.5
VMATRIX: Entity number 1 viewmatrix values 960.5 539.5
VMATRIX: Entity number 0 viewmatrix values 960.5 539.5
VMATRIX: Entity number 4 viewmatrix values 960.5 539.5
VMATRIX: Entity number 0 viewmatrix values 960.5 539.5
VMATRIX: Entity number 1 viewmatrix values 960.5 539.5
VMATRIX: Entity number 3 viewmatrix values 960.5 539.5
VMATRIX: Entity number 4 viewmatrix values 960.5 539.5
VMATRIX: Entity number 0 viewmatrix values -108333.4 539.5
VMATRIX: Entity number 1 viewmatrix values -108324.8 539.5

It seems to change between extremely high/invalid values and then stuck on 960 and 539.5 as I rotate my view around.

The biggest culprit I am assuming is the worldtoscreen function itself although it could be the way I am reading it I am not totally sure.

Any help would be grateful, Thank you.