AlexDR
November 25th, 2006, 01:13 PM
I'm trying to convert the low rigth corner of my full screen app from screen coords to 3d world coords.
This is my C# code:
Matrix mView = device.GetTransform(TransformType.View);
Matrix mProj = device.GetTransform(TransformType.Projection);
Matrix mWorld = device.GetTransform(TransformType.World);
Vector3 screencoords = new Vector3(device.viewport.width, device.viewport.height, 0f);
Vector3 coords3d = Vector3.Unproject(screencoords,device.Viewport, mProj, mView, mWorld);
but without result, because the 3d world coords returned are far away from the mentioned corner.
can anyone help me?
thanks.
Alex
This is my C# code:
Matrix mView = device.GetTransform(TransformType.View);
Matrix mProj = device.GetTransform(TransformType.Projection);
Matrix mWorld = device.GetTransform(TransformType.World);
Vector3 screencoords = new Vector3(device.viewport.width, device.viewport.height, 0f);
Vector3 coords3d = Vector3.Unproject(screencoords,device.Viewport, mProj, mView, mWorld);
but without result, because the 3d world coords returned are far away from the mentioned corner.
can anyone help me?
thanks.
Alex