Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Projection Matrix Declaration:
- ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 0.1f, 50f);
- //Ray Declaration
- //Create two vectors. One close up and one far away.
- MouseState mouseState = Mouse.GetState();
- Vector3 NearMouseSource = new Vector3(mouseState.X, mouseState.Y, 0.0000000000000000001f);
- Vector3 FarMouseSource = new Vector3(mouseState.X, mouseState.Y, 0.9999999999999999999f);
- NearPoint = Application.Renderer.device.Viewport.Unproject(NearMouseSource, ProjectionMatrix, ViewMatrix, WorldMatrix);
- FarPoint = Application.Renderer.device.Viewport.Unproject(FarMouseSource, ProjectionMatrix, ViewMatrix, WorldMatrix);
- //Device Setup
- GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement