View Full Version : NEED HELP FAST!!!!!
12-02-2003, 11:29 AM
Does anyone know how to move the eye of a cube along the x axis without using glulookat(...); Please Help!
12-02-2003, 11:38 AM
Why not use glTranslatef( xDist, 0.0, 0.0 )?
12-02-2003, 02:45 PM
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
12-02-2003, 03:47 PM
what precisely do you mean by the eye of the cube?
12-02-2003, 04:03 PM
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?
12-02-2003, 04:21 PM
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.
12-02-2003, 04:59 PM
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
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.
12-03-2003, 07:16 AM
Thanks man I'll give it a try!
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.