Sign in to follow this  
justinxnitsuj

rotation problem

Recommended Posts

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(); }

Share this post


Link to post
Share on other sites
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 back
Perform another rotation to get back to the original position.


You will have to replace your glRotate call with the above procedure .

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this