rotation problem

Started by
1 comment, last by justinxnitsuj 16 years, 11 months ago
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(); }
Advertisement
Why don't you try this ?

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 .
Best Regards,KumGame07
i solved it .. thank you :)

This topic is closed to new replies.

Advertisement