WorldToScreen External

Posts 1–2 of 2 · Page 1 of 1
WorldToScreen External
does anyone know how i can calculate the worldtoscreen for this game?

I'm using it this way and calculating like this, but it doesn't stay on the screen correctly

PlayerPosition
Code:
//How i use playerposition, because the y takes the position of the z
D3DXVECTOR3 Screen, HeadPos;	
		HeadPos = { pfnEntity[i].pos[0], pfnEntity[i].pos[2], pfnEntity[i].pos[1] };

WorldToScreen function
Code:
//Matrix 
//0xDD7230 offset CFBR
void WorldToScreen(D3DXVECTOR3* vecWorld, D3DXVECTOR3* vecScreen)
{	
D3DXMATRIX m;	
	ReadProcessMemory(MyHandle, (PBYTE*)(Crossfire + 0xDD7230), &m, sizeof(D3DXMATRIX), 0);
	
	DWORD dwLenX = rWidth;
	DWORD dwLenY = rHeight;
	
	vecScreen->x = vecWorld->x * m._11 + vecWorld->y * m._21 + vecWorld->z * m._31 + m._41;
	vecScreen->y = vecWorld->x * m._12 + vecWorld->y * m._22 + vecWorld->z * m._32 + m._42;
	vecScreen->z = vecWorld->x * m._13 + vecWorld->y * m._23 + vecWorld->z * m._33 + m._43;	
	
	float dv = 1.0f / vecScreen->z;
	vecScreen->x *= dv * dwLenX;
	vecScreen->y *= dv * dwLenY;
}
Could someone tell me why it doesn't work?
aa
Code:
bool World2Screen(D3DXVECTOR3* InOut) {
	D3DXVECTOR3 vScreen;
	D3DXVECTOR3 PlayerPos(InOut->x, InOut->y, InOut->z);
	D3DVIEWPORT9 viewPort = { 0 };
	D3DXMATRIX projection, view, world;
	view = CMemory::instance()->Read<D3DXMATRIX>(Matrix - 0x80);
	projection = CMemory::instance()->Read<D3DXMATRIX>(Matrix - 0x40);
	viewPort = CMemory::instance()->Read<D3DVIEWPORT9>(Matrix);

	world = D3DXMATRIX(
		1.0f, 0.0f, 0.0f, 0.0f,
		0.0f, 1.0f, 0.0f, 0.0f,
		0.0f, 0.0f, 1.0f, 0.0f,
		0.0f, 0.0f, 0.0f, 1.0f);
	D3DXVec3Project(&vScreen, &PlayerPos, &viewPort, &projection, &view, &world);
	if (vScreen.z <= 1.0f) {
		*InOut = vScreen;
		return true;
	}
	return false;

}
Need to import d3dx9.h and d3dx9.lib files
Matrix = 00 00 00 00 00 00 00 00 ?? ?? 00 00 ?? 03 00 00 ?? ?? ?? ?? 00 00 80 3F The static address found is
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us