View Full Version : Mouse projection

04-26-2002, 02:21 AM

i don't really know if this is advanced but i don't find a lot of info on my problem.

I have a scene with a movable camera. The thing i want to do is to determine, if you click with the mouse on the glwindow, where (@ wich coordinates (x,y,0)) the projection of that point on the xy-plane is.

So, for example, if i would draw a cube at this point, then the cube should move over the xy-plane following the mouse.

I have tried to calculate it out of my camera's parameters but i don't seem to get it right.

I can't determine the direction of the projectionline from the mouse to the xy-plane because i don't know the distance between the real viewpoint and the projectionwindow.

I've seen this working in a lot of modelling applications but don't find any info on it.

anyone able to help?

04-26-2002, 04:29 PM
hello, you have to use

i hope help you...

04-29-2002, 04:07 AM
I can indeed transform the screen co÷rdinates with the gluUnProject() routine but it requires a depth range in relation to the clipping-planes of the viewport. that's a value that's hard to get in my scenario.

Anyway, i managed to calculate it with 4 goniometric operations and it works fine,
but thanks for the tip http://www.opengl.org/discussion_boards/ubb/smile.gif

04-29-2002, 08:56 AM
that is the operations !!! thanks !!!!!