PDA

View Full Version : local rotation



gandalf3373
01-30-2005, 03:50 PM
i have been working on a modeling app in my spare time and am at the point where i am working on a rotation manipulation tool and i am wondering if it would be possible to get the local rotation to work using successive glRotated calls ( please read on this is a little more complex than it sounds ).

picture a rotated object in world space with its axes visible, then being able to click on the axes and drag or somesuch and have the model rotate only on the selected axis in object space.

if three successive glRotated calls are made like below...

glRotated( transform.rotation.z, 0,0,1 );
glRotated( transform.rotation.y, 0,1,0 );
glRotated( transform.rotation.x, 1,0,0 );


the last one will rotate precisely on the local axis (x), i understand that. but the y and z axis rotations will rotate in world space still ( or so it appears ). i would think there would be a way to coerce these three calls into performing what i am explaining by adjusting the angle values, for example, adjust all 3 angles to get a local rotation around the z axis without manipulating the axis values assuming the object is at the origin. my question is, how do i calculate these values??

any suggestions on a different way to handle this to get the results that i want?? i can use quaternions and glMultMatrix with a custom matrix, whatever, i just cannot seem to get the right matrix to make this work.

thanks

gandalf3373
02-02-2005, 01:44 PM
i am getting closer here but i sure could use some help if someone knows anything.

could the moderator/admin delete this topic post please?? i am going to post this in the math section.

thanks