Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

redneon

Rotate object around it's center

This topic is 5276 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

I''m programming a game in OpenGL and I''m wanting to rotate an object around the center of the object rather than the bottom corner. From doing a bit of reading I believe I can do this using quaternion but I can''t quite figure it out. Is there an easier way of doing it or can someone point me to a good description of how I can do it. Cheers, Darrell

Share this post


Link to post
Share on other sites
Advertisement
One way to do it would be to translate to the center of the object, then apply your rotation, then draw the object about its center:

glLoadIdentity () ;
glTranslate* (xCenter, yCenter, zCenter) ;
glRotate* (...) ;
//Draw Object

The current 3D position is the one that glRotate* will use to rotate about (i.e. whatever the 3D position is when glRotate* is called is what is used as the center of rotation). If you need something more specific, help us out and supply us with more information about what you are doing/how you're drawing the object, etc.

~Urayami

[edited by - urayami on June 4, 2004 3:24:02 PM]

Share this post


Link to post
Share on other sites

  • 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!