I have created a simple mesh picking code and placed it under my mouseup event, here is the block of code
for
(int i=0; i<50;i++){
//intersection informationIntersectInformation closest;
//the near vectorVector3 near;
//the far vectorVector3 far;
near =
new Vector3(e.X, e.Y, 0); //the mouse coordinatesfar =
new Vector3(e.X, e.Y, 1); //the mouse coordinatesnear.Unproject(sampleFramework.Device.Viewport,sampleFramework.Device.Transform.Projection, sampleFramework.Device.Transform.View, Matrix.Translation(MapX
, MapY
, MapZ
));
far.Unproject(sampleFramework.Device.Viewport, sampleFramework.Device.Transform.Projection, sampleFramework.Device.Transform.View, Matrix.Translation(MapX
, MapY
, MapZ
));
far.Subtract(near);
if(mesh2.Intersect(near, far, out closest)){
}
}
when near.Unproject() runs I get this error
Error in the application.
-2005530516 (D3DERR_INVALIDCALL)
at Microsoft.DirectX.Direct3D.Device.GetTransform(TransformType state, Int32*
result)
at Microsoft.DirectX.Direct3D.Device.GetTransform(TransformType state)
at Microsoft.DirectX.Direct3D.Transforms.get_Projection()
at Project1.Start.WindowForm_MouseUp(Object sender, MouseEventArgs e)
any ideas

Transform error
Josh D