Answers for "Problem finding relative rotation from one quaternion to another"
http://answers.unity.com/questions/35541/problem-finding-relative-rotation-from-one-quatern.html
The latest answers for the question "Problem finding relative rotation from one quaternion to another"Answer by LarryTheBrave
http://answers.unity.com/answers/1626431/view.html
I would convert the rotations to Euler Angles, do a Vector3 difference, then convert back to Quaternions. This can be done with .eulerAngles against the transform.rotation and then Quaternion.Euler outside the parentheses enclosing the Vector3 subtraction. To simply get the angle you can do Quaternion.Angle.Sat, 27 Apr 2019 17:24:14 GMTLarryTheBraveAnswer by HonoraryBob
http://answers.unity.com/answers/1526368/view.html
I tried to use the suggested code, but for some reason the result is always (0,0,0,1) even when there is a difference between the two quaternions as proven by using debug.log. Here's the code I'm using:
var ThisRot:Quaternion = transform.rotation;
var RotChange:Quaternion = Quaternion.Inverse(LastRot) * ThisRot;
Debug.Log("LastRot ="+LastRot+" ThisRot="+ThisRot+" RotChange="+RotChange);
LastRot = ThisRot;
Anyone know why this doesn't work?
[Edit: it turns out that it only seemed it didn't work because when Debug.Log prints out quaternions there's a one-digit limit for the fractional value, which means small angles don't show up.]Fri, 06 Jul 2018 21:53:30 GMTHonoraryBobAnswer by Mike 3
http://answers.unity.com/answers/35542/view.html
<p>This should do it:</p>
<pre><code>Quaternion relative = Quaternion.Inverse(a) * b;
</code></pre>Fri, 26 Nov 2010 12:57:24 GMTMike 3