Recommended Posts

I have a device that returns me all four components of a quaternion (X,Y,Z,W).
The problem is that,the rotation around the X and Z axis are inverse (i rotate the device left,i get a right rotation etc)
For what i know that quaternion rapresent orientation referring to an 'arbitrary' axis so i can't just negate the rotation like i would do with euler angles as far as i know
My code is:

Quaternion rotation = new Quaternion(X,Z,Y, -W); //i had to swap Z and Y due to the device axis orientation so i had to negate W
model.World = Matrix.CreateFromQuaternion(rotation)*Matrix.CreateTranslation(Vector3.Zero);