Source Code Ghost Recon Phantoms World2Screen

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat


Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
Since I've already posted some entity info on the game before, this time W2S

bool W2S(D3DXVECTOR3* screen, D3DXVECTOR3* world)
	Matrices* pMat = (Matrices*)OFFSET_MATRICES;

	D3DXMATRIX projection = pMat->Projection, temp;
	memcpy(&temp.m[1][0], &pMat->ViewMatrix._31, sizeof(D3DXVECTOR3));
	memcpy(&temp.m[0][0], &pMat->ViewMatrix._11, sizeof(D3DXVECTOR3));
	memcpy(&temp.m[2][0], &pMat->ViewMatrix._21, sizeof(D3DXVECTOR3));

	D3DXVECTOR3 delta;
	D3DXVec3Subtract(&delta, world, (D3DXVECTOR3*)&pMat->ViewMatrix._41);

	float viewX = D3DXVec3Dot(&delta, (D3DXVECTOR3*)&temp.m[0][0]);
	float viewY = D3DXVec3Dot(&delta, (D3DXVECTOR3*)&temp.m[1][0]);
	float viewZ = D3DXVec3Dot(&delta, (D3DXVECTOR3*)&temp.m[2][0]);
	D3DXVECTOR3 projected(viewX, viewY, viewZ);

	float x = D3DXVec3Dot(&projected, (D3DXVECTOR3*)&projection.m[0][0]);
	float z = D3DXVec3Dot(&projected, (D3DXVECTOR3*)&projection.m[1][0]);
	float y = D3DXVec3Dot(&projected, (D3DXVECTOR3*)&projection.m[2][0]);

	if (z < 0.001f)
		return false;

	x = (::screen.X + ::screen.Width / 2.f) * (1 + (x / viewZ));
	y = (::screen.Y + ::screen.Height / 2.f) * (1 - (y / viewZ));

	screen->x = x;
	screen->y = y;
	return true;
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.

Similar threads

Community Mods