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

axis,rotation

Started by
1 comment, last by amigos 23 years, 10 months ago
I have drawn a rod with its centre at 0.0.0.When I use rotate it is rotated at its centre. Is there a way to rotated about an axis at the 2/3 of its length ,without changing the way it is drawn (with 0.0.0 at its center) ?
Advertisement
actually, yes, and no.

you HAVE to translate the rotation point to the origin, then after translation, you translate it back to it''s original position.

glpush
gltranslate(0,0,.66);
glrotate(angle, axis);
gltranslate(0,0,-0.66);//translate back
glpop

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Perfect !! I have done it using :
GLfloat x=angle;
GLfloat y=point of pivot*sin(x*(180.0/3.14));
glRotatef(-x,0.0,0.0,1.0);
glTranslatef(-y,0.0f,0.0f);

but your way is much simpler.
Thanks!

This topic is closed to new replies.

Advertisement