i'm referring to this thread:http://www.mmowned.com/forums/wow-me...ame-world.html
i'm trying to use this for world to screen projection
Code:
struct SCameraInfo
{
DWORD dwFoo1[2];
float fPos[3];
float fViewMat[3][3];
DWORD dwFoo2[2];
float fFov;
};
#define WOW_CAMERA_PTR1 0xB0D578
#define WOW_CAMERA_OFFSET 0x7E24
bool WorldToScreen( float x, float y, float z, POINT *pt )
{
SCameraInfo cam = read<SCameraInfo>(read<int>(read<int>(WOW_CAMERA_PTR1)+WOW_CAMERA_OFFSET));
D3DXVECTOR3 Out, In( x, y, z );
D3DVIEWPORT9 Viewport;
D3DXMATRIX Proj, View, World;
float fAspect = ((float)1024) / 768;
D3DXMatrixPerspectiveFovRH( &Proj, cam.fFov*0.6, fAspect, 1.0f, 10000.0f );
D3DXVECTOR3 vEyePt( cam.fPos[0], cam.fPos[1], cam.fPos[2] );
D3DXVECTOR3 vLookatPt( Localplayer.X(), Localplayer.Y(), Localplayer.Z() );
D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f );
D3DXMatrixLookAtRH( &View, &vEyePt, &vLookatPt, &vUpVec );
m_pDevice->GetViewport(&Viewport);
D3DXMatrixIdentity(&World);
D3DXVec3Project( &Out, &In, &Viewport, &Proj, &View, &World );
pt->x = Out.x;
pt->y = Out.y;
return ( Out.z < 1.f );
}
if i draw a rectangle at position of the npcs:

depending on my camera rotation this cluster of rectangles rotates really strange
but i can't what i did wrong, so i hope maybe somebody here does see it