Answers for "Invert quaternion rotation"
http://answers.unity.com/questions/1144912/invert-quaternion-rotation.html
The latest answers for the question "Invert quaternion rotation"Answer by Eno-Khaon
http://answers.unity.com/answers/1145034/view.html
I would suggest utilizing an extra empty object to convert your rotations accurately.
Namely, use your first example to rotate an empty object, to get proper orientation to prepare to convert to a new set of axes.
Quaternion q = arduino.getQuaternion ();
emptyObject.rotation = Quaternion.Slerp(emptyObject.rotation, q, Time.deltaTime * arduino.getEasingValue());
Then, you can break down each axis and convert them for use in your visible object. However, doing t$$anonymous$$s requires special attention paid to the order of operations. According to Unity's [documentation on Euler Angles][1],
> The x, y, and z angles represent a
> rotation z degrees around the z axis,
> x degrees around the x axis, and y
> degrees around the y axis (in that
> order).
Applying t$$anonymous$$s in your case, then, can be done like t$$anonymous$$s:
Vector3 v = emptyObject.eulerAngles;
transform.rotation = Quaternion.AngleAxis(v.y, Vector3.right) * Quaternion.AngleAxis(-v.x, Vector3.forward) * Quaternion.AngleAxis(-v.z, Vector3.up);
The angles are applied matc$$anonymous$$ng the order of Unity's application of axes, in the correct order, but are then applied to the relative axes to w$$anonymous$$ch they now correlate.
[1]: http://docs.unity3d.com/ScriptReference/Transform-eulerAngles.htmlSat, 20 Feb 2016 19:42:14 GMTEno-Khaon