I’m working with DirectX (C++) and inside a game i have the coordinates of an object somewhere in a world (x,y,z).
How can i translate the objects coordinates to screen coordinates? I’m particularly interested in Vector3 to Screen positions, if that’s even possible?
An example of the coordinates i have is:
x=1403.722900
y=2892.604736
z=79.125000
The DirectX function you need is D3DXVec3Project
http://msdn.microsoft.com/en-us/library/windows/desktop/bb205516%28v=VS.85%29.aspx
You pass in a D3DXVECTOR3 in world coordinates, along with pointers to the viewport and the various matrices (world, projection, view). Output of the function is the screen coordinates.
There is also a D3DXVec3Unproject function for going the other direction, from screen coordinates to world coordinates.