Advertisement

question about rotations/translations

Started by February 12, 2003 10:10 PM
-1 comments, last by Sketchy 22 years ago
Hey, So I''m trying to write a program to rotate/translate a cube in 2 different modes, model and world. You can switch between modes, and the rotation translation behaviour should be as follows: In model mode, translations and rotations are in terms of the cube, so if you rotate it, then translate it, it will be translated along the rotated axes. Also, if you translate and then rotate, the object will rotate on the spot, around its own axes, not around the origin. In world mode, translates/rotates are in terms of the origin. If you rotate, then translate, you will still translate along the original axes (the horizontal/vertical/in or out of screen). If you translate, then rotate, the model should rotate around the original axes, not its own. My problem is with the ordering I need to use in order to accomplish this. Currently I''m doing: ModelRotate() ModelTranslate() WorldTranslate() WorldRotate() where you can switch from world to model mode, and between rotating and translating in that mode. the variables used to get the proper rotations are increased/decreased via movement of the mouse in the correct mode. unfortunately, this setup gives me the wrong results. for example, if im in model mode, rotating then translating is ok, but if I translate then rotate, the object rotates with respect to the origin. The same goes for world mode, translating then rotating results in rotation with respect to the model. ARGH Any help, or helpful links would be appreciated Thanks in advance, SKetchy

This topic is closed to new replies.

Advertisement