rotation problem
hi. i need to rotate a door but i don't know how to rotate through hinge. how can i translate the rotation axis. i have to keep that code structure, what will change or add to it ?
void DrawDoor (float x,float y,float z,float angle){
glPushMatrix();
glTranslatef(x,y,z);
glRotatef(angle,0.0f,1.0f,0.0f);
glScalef(5.0f,10.0f,0.3f);
BaseDoor(0.0f,0.0f,0.0f);
glPopMatrix();
}
Why don't you try this ?
You will have to replace your glRotate call with the above procedure .
Align the door parallel to Y axis (you may have to rotate it !!) Translate your door to align it on along the Y axis Rotate the door about Y axis (Here you perform the actual rotation) Translate backPerform another rotation to get back to the original position.
You will have to replace your glRotate call with the above procedure .
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement