TheBlob

06-04-2002, 07:37 AM

Hi!

I´m working on a proper working camera for my application...I´ve go it working a bit, but an essential part is missing.

I´m using gluLookAt(...) to simulate my camera. So I pass the x,y,z values of my camera as the first parameters and then a point which is faced by the camera....I could figure out the x and y coordinate, but the z coordinate???

Here´s a little code:

float tDir_x, tDir_y, tDir_z;

tDir_x = x + cos(angle_z);

tDir_y = y + sin(angle_z);

tDir_z = ????; //something with angle_x...

gluLookAt(x,y,z,tDir_x ,tDir_y,tDir_z,0.0f,0.0f,-1.0f);

angle_x and angle_z are calculated by the offset of the mouse position, so you can look around with the mouse.

Someone has an idea??

Thanks in advance!!

I´m working on a proper working camera for my application...I´ve go it working a bit, but an essential part is missing.

I´m using gluLookAt(...) to simulate my camera. So I pass the x,y,z values of my camera as the first parameters and then a point which is faced by the camera....I could figure out the x and y coordinate, but the z coordinate???

Here´s a little code:

float tDir_x, tDir_y, tDir_z;

tDir_x = x + cos(angle_z);

tDir_y = y + sin(angle_z);

tDir_z = ????; //something with angle_x...

gluLookAt(x,y,z,tDir_x ,tDir_y,tDir_z,0.0f,0.0f,-1.0f);

angle_x and angle_z are calculated by the offset of the mouse position, so you can look around with the mouse.

Someone has an idea??

Thanks in advance!!