# NEED HELP FAST!!!!!

Does anyone know how to move the eye of a cube along the x axis without using glulookat(…); Please Help!

Why not use glTranslatef( xDist, 0.0, 0.0 )?

does this translate just translate the 3d cube or does it move the eye of the cube around the x axis. b/c thats what i need to do

what precisely do you mean by the eye of the cube?

well… if you want it to rotate around you while seeing only one side of it… you can do this:

glRotatef(rotation++,0,0); //rotation is a variable
glTranslatef(0,0,-distance); //distance is whatever u want… constant
//draw cube here

is this what u want?

Yes it’s kindof what I want but what do I put where you have rotation++, do I put the value of my x coordinates of my cube?I just don’t understand how to use it. I want the cube to rotate but stay in the same spot. So when you want to increment the eye.x position the cube turns as if you were looking from the x axis.

The order in which you rotate and translate makes a big diffrence.

glTranslate( X,Y,Z); // In your case we use the X, and zero the others. Where X is the distance from the cube, or radius of rotation around the cube.

glRotate( Angle of rotation 0-360, X, Y, Z); // Place a 1 in the axis to rotate and zero in all others

Draw_cube();

Also understand that everything is relative to 0,0,0; that includes the camera and that camera does not move but we instead move the world around the camera.

Also understand that openGL operations work in reverse order on the objects.

So what happens with the above code is that the cube will be rotated some ?-degrees and then translated out some distance from the camera to simulate the camera rotating around the cube on the X axis.

Thanks man I’ll give it a try!