Ok, I’m having some real problem trying to make this work

I figured, first three parameters (eye) are the position of the “camera”, the next three (center) are the vector in wich the “camera” is looking, and the last three (up) is the vector that indicates the up direction.

If I move only the eye coordinates, the camera “flips” direction when I cross the center vector. That´s predictable. So I have to move the center vector whenever I move the eye vector. That´s fine.

But when I rotate, I move the center vector. So now, when I try to move the eye ahead, I can’t just increse the z position of the eye vector, because I ain’t really aligned to the world

So far so good? So I have to move all three coordinates in eye vector to move forward, right? What are the equations to that? I did it once, but I guess I forgot how to do it…

Matheus Degiovani.

Put your code on the forum; only the draw routine.

If you want to you can use this procedure.

GLvoid glRotation(GLfloat ox, GLfloat oy, GLfloat oz, GLfloat rx, GLfloat ry, GLfloat rz,
GLfloat nx, GLfloat ny, GLfloat nz)
GLfloat tx[2], ty[2], tz[2];
tx[0] = ox;
ty[0] = (oy
((GLfloat)cos(rx/(180/3.142))) - (oz
tz[0] = (oy
((GLfloat)sin(rx/(180/3.142))) + (oz*((GLfloat)cos(rx/(180/3.142)))));
tx[1] = (tx[0]((GLfloat)cos(ry/(180/3.142))) + (tz[0]((GLfloat)sin(ry/(180/3.142)))));
ty[1] = ty[0];
tz[1] = -(tx[0]((GLfloat)sin(ry/(180/3.142))) + (tz[0]((GLfloat)cos(ry/(180/3.142)))));
nx = (tx[1]((GLfloat)cos(rz/(180/3.142))) - (ty[1]((GLfloat)sin(rz/(180/3.142)))));
ny = (tx[1]((GLfloat)sin(rz/(180/3.142))) + (ty[1]
*nz = tz[1];

Let me explain the paramaters…

ox, oy, oz what axis rotation takes place on. Must be 0, 0, 1 or 0, 0, -1;
rx, ry, rz is the variables that are used to for the rotation.
nx, ny, nz the result of the rotation. nx, ny, nz are going to be used as your velocity additions for the x, y, z.


glRotation(0, 0, -1, cam.rx, cam.ry, cam.rz, &cam.tx, &cam.ty, &;

I hope that this helps.