Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#Actualhandsfelloff

Posted 26 January 2013 - 06:43 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

#2handsfelloff

Posted 26 January 2013 - 06:43 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

#1handsfelloff

Posted 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