Jump to content
  • Advertisement
Sign in to follow this  
justinxnitsuj

rotation problem

This topic is 4089 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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 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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!