It sounds like you're trying to overcome Gimbal lock. I ran into the same problem with my own camera but I haven't gotten around to fixing it yet. It looks like the definitive solution is quaternion rotation. http://www.gamedev.net/reference/programming/features/quatcam/ Vince~ --- richard sabbarton <richard.sabbarton@xxxxxxxxx> wrote: > Hi Guys, > > I have a problem and I am absolutely sure that I > have missed something > obscenely obvious. This is C++ with OpenGL/SDL. > > In a 3D environment my player struct has 3 values > for rotation around > x,y and z. I want the player to be able to freely > rotate around all 3 > axis and I always want the mouse/joystick/keypad to > operate the x and > y axis rotation. When I initially move the mouse > the rotation is > correct. Left/Right and my scene rotates left and > right. > > If I rotate around z and then move the mouse my > scene moves up and > down instead of left and right. Now, I thought that > all I needed to > do was change the order in which I rotated around > each axis. I > thought that if I rotated around Z first and then x > and y after then > the movement of the mouse would always appear > correct onscreen. This > is what I call: > > glRotatef(Player.ZRot,0.0f,0.0f,1.0f); // Rotation > around Z axis > glRotatef(Player.YRot,1.0f,0.0f,0.0f); // YRot is up > and down around X axis > glRotatef(Player.XRot,0.0f,1.0f,0.0f); // XRot is > left and right around Y axis > > > I thought that after performing the rotation the > subsequent rotations > would be relative to the previous one. So, if I > rotate 90deg around Z > I thought it would then rotate relative to that > effectivly switching > the x and y axis. But it doesn't does it... > > So I guess that is my question... How do I perform > a rotation and > then make all subsequent rotations relative to that > initial rotation? > > Regards > > Richard > > --------------------- > To unsubscribe go to > http://gameprogrammer.com/mailinglist.html > > > ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html