Original Post
Hey there, it's my 1st post, so sorry for any noobness I'm having some trouble with quaternions, I'm sorry if I can't provide much detail but I believe that anyone who messed with D3DXQUATERNIONS had them, they seem to be a bit unstable sometimes. I was making this roll/pitch/yaw functions by getting the local axis for my object (by converting my quaternion to a rotation matrix thru D3DXMatrixRotationQuaternion) and rotating around them. Well after a certain angle my object starts to spin in every direction O_o By googling a little I found out that giving 2 "directions" A and B there are two quaternions that can perform it, a quaternion and it's "inverse" but when point A and B are exactly opposite (180degrees) there's an infinite number of quaternions that can perform the rotation, that's the reason it "screws up". Well, to solve that, I tried to leap to the next valid position, so, if my quaternion was > 90 it should go to -90, strangely instead of jumping it seems that it did a 360 degree spin to the other way and then started rotating in the right direction again... I simply DID NOT coded that... it goes to "0", then it goes to something close to 10 degrees, go back to about 2 degrees, then to -89 or something... and starts rotating normally... I know it sounds kinda crazy... but It's happening, any clues? I could send the exe if someone's interested Here's a little demonstration of the values of the W on the quaternion and the values in degrees (later converted to radians) in the moment this kind of thing happens http://img40.imageshack.us/img40/1874/quatweird.jpg