🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Rotating around an objects origin
I''m trying to rotate a single quad around the Y axis so it spins on it''s center of origin. However it doesn''t it does a little orbit around a different origin. How do I fix/stop this and and return the center of origin to the center axis of the object. I''ve tried using glPush and PullMatrix but this makes the problem worse. Any ideas.
It sounds like you have your order of operations mixed up. You have to perform the local rotation operation before you do the translation. I don''t think that you can concatinate the rotation/translation. Also make sure that your center of rotation is the center of the poly and not some point outside or it won''t work either.
Creativity -- Concept -- Code
Your game is nothing if you don't have all three.
Creativity -- Concept -- Code
Your game is nothing if you don't have all three.
glPushMatrix();
glTranslatef(obj.x,obj.y,obj.z); // placement of object
glRotate3f(angle,0,1,0);
draw object
glPopMatrix();
glTranslatef(obj.x,obj.y,obj.z); // placement of object
glRotate3f(angle,0,1,0);
draw object
glPopMatrix();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement