RayCast with x negative values

h[Oz]
Posts: 6
Joined: Thu Aug 29, 2013 11:49 am

RayCast with x negative values

Post by h[Oz] »

Hello,

I followed this tutorial (http://www.opengl-tutorial.org/miscella ... s-library/) to build a Mouse Picker for my Quartz Composer Bullet plugin, and everything works well except that... even if the ray seems visually to touch bodies on the left part of the screen, it doesn't return the touched body.

Quartz Composer coordinates are from -1 to 1, and it works well with negative y values of the mouse. I don't understand and would really appreciate some help with it. May be someone had the same trouble once ?

FYI, I'm using Eigen to manipulate matrices.

Here are the screenshots of my scene, rotated so you can see the ray.

The raycast don't catch the body
rayNotOK.jpg
The raycast catch the body
rayOK.jpg
You do not have the required permissions to view the files attached to this post.
Last edited by h[Oz] on Fri Sep 06, 2013 6:19 pm, edited 1 time in total.
h[Oz]
Posts: 6
Joined: Thu Aug 29, 2013 11:49 am

Re: RayCast with x negative values

Post by h[Oz] »

Well, that was an error from my part :

I have a plane closing the global bounding box at Z = 0., but with back face culling. At the right part of the screen (positive x values), if I set my origin point at Z=0. the RayCast points behind this plane, at the left (negative x values) it points on this plane and returns the plane as touched body.