View Full Version : Rotation Nightmare

I wrote commands that turn quaternions and convert eulers to quats and back, using Blitz3D as a template for testing. The problem is when I apply the rotations in OpenGL, yaw and roll turn the direction opposite of Blitz3D. I tried glScalef 1,1,-1 to correct for the coordinate system, but the rotations themselves seems to be unaffected. Any advice?

[This message has been edited by halo (edited 01-31-2004).]

nexusone

02-01-2004, 03:46 AM

The problem could be that Blitz3D uses a left hand coordinat system and openGL uses the right hand system.

I don't think the scale command is the correct way to fix this problem.

The diffrence between the two systems is that the x and z are inverse directions from each other. So I think buy adding 180 to both before sending to openGL will correct this on rotations.

On x/y coords you have to invert the number so -0.1 becomes 0.1

Right, Blitz3D is DirectX, so it is right(?)-handed.

Thanks for the tip. I'll let you know what I find.

No, it's foobar. Anyone know how to do this? I am testing against Blitz3D, so I know the numbers for pitch, yaw, and roll are right. I just need to display the rotations the same way. I am doing it like this:

glRotatef EntityRoll(entity),0,0,1

glRotatef EntityPitch(entity),1,0,0

glRotatef EntityYaw(entity),0,1,0

Drakkhen

02-03-2004, 12:33 AM

I faced something like that and the solution was in axis swapping. Try sending the coordinates this way: y,x,z without any sign.

If you have made a rotation function, make constant rotations on ONE relative axis at a time on your object. If your axis aren't well defined, a small rotation on one axis will make the rotations on another one looks weird (as if your second rotation axis was changing during rotation).

A good solution to figure out what axis is right is to use coloured lines (RGB) to represent axis and to use an axis relative rotation function to see what axis turns right (positive or negative angle, still relying on left/right hand system). Assuming you have a CORRECT rotation procedure, of course.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.