Hello,

I am somehow stuck, and I can’t get any further searching the news

groups:

The problem:

I just want to shoot a straight line through an object under the current cursor position.

The set up:

I use

gluPerspective(45,(w / h),0.1,1000);

and the camera is with gluLookAt

0,0,70 facing the 0,0,0 (orgin);

The window is 300 * 300 pixel (w, h);

I tried using the gluUnProject() function as described in previous posts put somehow does this not work. I am as well not sure how to convert the actual mouse coords into screen coord at my current position. (I tried to find out the z-heigth at my camera position with tan and mapped it to the realtive mouse coords):

float zCoord = tan(PI/8) * pCamera->vActualCamPosition.z; vMouse.x = (float)zCoord/(iWindowWidth/2) * (float)( x -

(iWindowWidth/2));

vMouse.y = (float)zCoord/(iWindowHeight/2) * (float)((iWindowHeight/2)

- y);

vMouse.z = pCamera->vActualCamPosition.z;

or is this complete nonsense?

I would very appreciate if someone could help me.

Thanks a lot in advance

chris.