I'm returning the W component of a quaternion in bullet but for some reason it does something that I personally wouldn't consider to be normal. Basically I'm trying to use this W component to calculate the angle it represents in radians but upon returning the W component it completely skips -0.5 to -1.. instead it decides at -0.5 it should switch to 0.5 and then go to 1?
In degrees, this is effectively going from 0 to 240, then instantly dropping from 240 to 120 and continuing down to 0.
Is this meant to happen? :S
Quaternion
-
- Posts: 17
- Joined: Sun Sep 25, 2011 8:13 pm
Re: Quaternion
did you figure out what was going on? I am having the same problem 

-
- Posts: 52
- Joined: Wed Sep 28, 2011 8:36 am
- Location: France
Re: Quaternion
Well, in quaternions, the value (x, y, z, w) means the same rotation than (-x, -y, -z, -w).
Maybe the problem is that you use w out of its context, and don't take into account other values ?
Maybe the problem is that you use w out of its context, and don't take into account other values ?
-
- Posts: 168
- Joined: Tue Jan 04, 2011 11:47 pm
Re: Quaternion
Why not just the existing functions in the class btQuaternion to do the transformation between Quaternion ad normal radian degree ?iLoggie wrote:I'm returning the W component of a quaternion in bullet but for some reason it does something that I personally wouldn't consider to be normal. Basically I'm trying to use this W component to calculate the angle it represents in radians but upon returning the W component it completely skips -0.5 to -1.. instead it decides at -0.5 it should switch to 0.5 and then go to 1?
In degrees, this is effectively going from 0 to 240, then instantly dropping from 240 to 120 and continuing down to 0.
Is this meant to happen? :S
-
- Posts: 52
- Joined: Wed Sep 28, 2011 8:36 am
- Location: France
Re: Quaternion
Well, I'll try to explain better what I meantiLoggie wrote: In degrees, this is effectively going from 0 to 240, then instantly dropping from 240 to 120 and continuing down to 0.
Is this meant to happen? :S

I guess you're getting the (w) value of a quaternion of something rotating around an axis. Let's say that the axis is (0,0,1). At the beginning, the quaternion is (0,0,0,1), and it increase to something like (0,0, 0.707, 0.707), which represents a rotation of 90° degrees around the X axis, in the positive direction.
Now at some time, the quaternion become (0, 0, -0.707, -0.707) instead of (0,0, 0.707, 0.707), so when you take care only of the (w) value, you think the rotation angle brutally switched from 90° to -90°.
Well, yes that's the case, but what you forgot is the at the same time, the rotation axis changed sign to, and it became (0,0,-1), which means the rotation is now of -90° around the X axis, in the negative direction. Finally it represents exactly the same rotation as before.
So, as is saying Dr.Shepherd, you should use the existing functions, which are taking care of the axis as well
