jacksmash

05-03-2010, 10:27 AM

Ok, I tried to explain this somewhat in the beginner's forum, but either this isn't a beginner's topic, or I didn't explain it very well.

Note the image below:

http://www.joelglanfield.com/images/grid.jpg

All I'm trying to do is compute whether the vector is intersecting a cell on the grid. The vector is computed using glUnProject (two calls) using the near and far clipping panes. This gives me a 3D vector that represents a line going through the mouse cursor towards the far clipping pane. I just want to determine which cell the vector intersects.

Problem is, the cell coordinates are all on the same plane. When I do a global rotate, the grid is rotated but I'm not sure how to tell what the actual coordinates are for each cell. Do I need to apply rotation matrices in some way?

Thanks for any responses.

Note the image below:

http://www.joelglanfield.com/images/grid.jpg

All I'm trying to do is compute whether the vector is intersecting a cell on the grid. The vector is computed using glUnProject (two calls) using the near and far clipping panes. This gives me a 3D vector that represents a line going through the mouse cursor towards the far clipping pane. I just want to determine which cell the vector intersects.

Problem is, the cell coordinates are all on the same plane. When I do a global rotate, the grid is rotated but I'm not sure how to tell what the actual coordinates are for each cell. Do I need to apply rotation matrices in some way?

Thanks for any responses.