daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest May 19th, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Projection Matrix Declaration:
  2.  
  3. ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 0.1f, 50f);
  4.  
  5.  
  6.  
  7.  
  8. //Ray Declaration
  9.  
  10.             //Create two vectors. One close up and one far away.
  11.             MouseState mouseState = Mouse.GetState();
  12.             Vector3 NearMouseSource = new Vector3(mouseState.X, mouseState.Y, 0.0000000000000000001f);
  13.             Vector3 FarMouseSource = new Vector3(mouseState.X, mouseState.Y, 0.9999999999999999999f);
  14.  
  15.             NearPoint = Application.Renderer.device.Viewport.Unproject(NearMouseSource, ProjectionMatrix, ViewMatrix, WorldMatrix);
  16.             FarPoint = Application.Renderer.device.Viewport.Unproject(FarMouseSource, ProjectionMatrix, ViewMatrix, WorldMatrix);
  17.  
  18.  
  19. //Device Setup
  20.  
  21. GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);
RAW Paste Data
Top