PDA

View Full Version : 3D-Rotating Algorithm



amstel
03-15-2002, 07:29 PM
On 2D-Scene,I can simply use the change in vertical and horizontal position when mouse movement to rotate and translate any object.
But on 3D-Scene,there are some problems occured.
1. If object is rotated until the x-y plane(default plane) is replaced by the y-z one,then I try to translate object along the horizontal axis by use the horizontal position change when mouse movement. The object is moved into or out of the scene.
2. Similarly problem occured when I rotated.

Have anyone to give me some agorithm or sampling code to do so.?

Thanks in advance.

amstel.

Marc
03-18-2002, 03:07 AM
Jeff Moloffee has a sample space shooter on his website: nehe.gamedev.net. There so called quaternions are used for free movement in space. I didn't read the code, but from the description it should be, what you are looking for.

Marc