View Full Version : Object movement
How do move an object's xyz axis' in opengl? Or how can I move the object forward and backward? Am I being too vague in my questions? Thanks...
ZbuffeR
06-24-2004, 10:54 AM
glTranslated(x,y,z) if your values are doubles or glTranslatef(x,y,z) if your values are floats.
Is my answer precise enought ? Thanks... :p
Aeluned
06-24-2004, 10:54 AM
here's one way:
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
//now you perform your transforms
glTranslatef(deltaX,deltaY,deltaZ);
glRotatef(theta,x,y,z);
glScalef(xScale,yScale,zScale);
//Render your object
glPopMatrix(); //restore modelview matrix
Thanks... How could I get a camera to follow it? Thanks again...
ChinaShrimp
06-24-2004, 10:06 PM
I think When you move the object, the camera's position doesn't change. It's decided by the parameters of gluLookAt.
Could I make it change according to the objects position?
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.