Original Post
Hi, I have a static method that Unprojects screen coordinates into 3D. But sometimes Vector3.Unproject returns wrong result. For example: //Coordinates x = 753; y = 516; //Set the points that should be Unprojected nearVector.X = x; nearVector.Y = y; nearVector.Z = 0; farVector.X = x; farVector.Y = y; farVector.Z = 1; //Then I'll project them back into screen coordinates //(to show the problem) Vector3 ufv; Vector3 unv; //Unproject the points nearVector.Unproject(engine.activeDevice.Viewport, engine.activeDevice.Transform.Projection, engine.activeDevice.Transform.View, engine.activeDevice.Transform.World); farVector.Unproject(engine.activeDevice.Viewport, engine.activeDevice.Transform.Projection, engine.activeDevice.Transform.View, engine.activeDevice.Transform.World); //And Get back the scren coordinates ufv = farVector; unv = nearVector; ufv.Project(engine.activeDevice.Viewport, engine.activeDevice.Transform.Projection, engine.activeDevice.Transform.View, engine.activeDevice.Transform.World); unv.Project(engine.activeDevice.Viewport, engine.activeDevice.Transform.Projection, engine.activeDevice.Transform.View, engine.activeDevice.Transform.World); //------------------ So, after the first call all works great, and Unproject -> project is correct 1 Here is the example X 753.0001 Y 515.999939 But, after all following calls, I have the wrong results, like this 2 Click X 981.5509 Y 440.579651 If Someone Has an Idea, about the mistake, Please answer