View Full Version : rotation issue

07-14-2001, 04:10 AM

Ok, I've been coding for a couple of weeks, but so far this is the toughest problem I've faced. When I create an object (let's say a cube) on the center of the world, and I rotate it, all functions very well. But when I create it let's say on the left of the world, it rotates around the world's axis, not around the object's axis. I've came up with 2 solutions: create all objects on the center, rotate them and translate for the position, or do some calculations, multiply a certain matrix to the current one, and rotate only the object. Is this right? Is there another solution?


07-14-2001, 08:21 AM
I personally prefeer the Matrix method. Both are good though

07-14-2001, 03:08 PM

And what is the exact transformation? For example, if the cube is located for the right of the world axis, I call glTranslate with "x" being half of the cube's width? Is that right?

Matheus Degiovani.

07-15-2001, 12:35 AM
theres some links at www.flipcode.com (http://www.flipcode.com) so some nice linear algebra tutorials

basically youre on the right track

translate the object to world pos 0,0,0
apply the rotation
translate it back to where it was