I am working on a program that displays 4 robots drawn using cylinders and spheres and they move foward and backward and side to side using the arrow keys and the mouse rotates them. I am having trouble geting them to rotate around the point they are standing at. After I move them away from their starting position when I rotate them they rotate around the starting point but I want them to rotate around the point they are standing at. If I reverse the glrotate and gltranslate they rotate correctly but no longer move in the direction they are facing. Is there even a way to get the robots to walk the way they are facing and still rotate around the point they are standing?
Here is some of my code
[ code ]
void Robot::DrawHead()//draws the head of the character
{
glPushMatrix();
glTranslatef(sidedistance,1.3,distance);//sidedistance is distance up and down x axis and distance is distance up and down z axis
glRotatef(90.0,1.0,0.0,0.0);
GLUquadricObj* head=gluNewQuadric();
gluSphere(head,0.3,20,20);
glPopMatrix();
}
//Other parts drawn and omitted