Jump to content

  • Log In with Google      Sign In   
  • Create Account


handsfelloff

Member Since 25 Jan 2013
Offline Last Active Jan 27 2013 05:44 AM

Posts I've Made

In Topic: Mouse X/Y ray to Sphere Intersection to world space point

26 January 2013 - 05:02 AM

Fixed it ;) For any interested please read.
Yes as I thought it was the the viewport transformation to NDC (normalized device coordinate ) coordinates:
75b617cc4ce8ff79820a327d824d5c5d.png
Code changed to this fixed it.


ray_start[0] = (x / viewer.view.viewport.width()) * 2 - 1;

ray_start[1] = -(y / viewer.view.viewport.height()) * 2 + 1;

ray_start[2] = 1;

ray_dest[0] = (x / viewer.view.viewport.width()) * 2 - 1;

ray_dest[1] = -(y / viewer.view.viewport.height()) * 2 + 1;

ray_dest[2] = 0;

Cheers,
Wilson

PARTNERS