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
WorldToScreen function
Could someone tell me why it doesn't work?
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;
}