Comments and 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 comments and answers for the question "Problem finding relative rotation from one quaternion to another"Comment by Ryan-Gatts on Ryan-Gatts's answer
http://answers.unity.com/comments/1734372/view.html
Ah, thanks for this. 10 years on and this is still really helpful!Mon, 25 May 2020 00:35:50 GMTRyan-GattsComment by Owen-Reynolds on Owen-Reynolds's answer
http://answers.unity.com/comments/1659559/view.html
Surprisingly, this is wrong. It makes sense, but it's completely not-even-close wrong. If you have two eulerAngle rotations, the inverse is _not_ Quaternion.Euler(difference-in-xyz's). Put another way q1*(difference in xyz's) != q2. Not the other way around, either. You can test by computing the inverse and printing the euler angles.
It's because in q1*q2, q2 is on the _local_ axis of the q1. If you went 20 on the real y, you can't cancel it by going -20 on the local y.Wed, 21 Aug 2019 23:01:50 GMTOwen-ReynoldsAnswer 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 GMTHonoraryBobComment by jconsole on jconsole's answer
http://answers.unity.com/comments/1355566/view.html
Yeah, just to reiterate, the ordering matters!Fri, 19 May 2017 22:08:54 GMTjconsoleComment by silentslack on silentslack's answer
http://answers.unity.com/comments/1225478/view.html
Damn! I've had so many issues over delta rotations and I've only just realised that Quaternion.Inverse(a) * b results in a different rotation to b * Quaternion.Inverse(a). How did I not know that. Grrrrrrrr!Fri, 05 Aug 2016 11:15:48 GMTsilentslackComment by Slugslinger on Slugslinger's answer
http://answers.unity.com/comments/1128529/view.html
I have the same doubt that @Max-Pixel, can someone explain why in Unity we put the Inverse first? Is this really correct or the Inverse in last can work as well?Sun, 17 Jan 2016 14:49:12 GMTSlugslingerComment by Max-Pixel on Max-Pixel's answer
http://answers.unity.com/comments/843451/view.html
Weird, I wonder why in Unity the from is inverted and comes first, while in regular mathematics (at least according the the following link), the from is still inverted but comes last.
http://stackoverflow.com/questions/1755631/difference-between-two-quaternionsSat, 29 Nov 2014 19:23:35 GMTMax-PixelComment by elliospizzaman on elliospizzaman's answer
http://answers.unity.com/comments/755173/view.html
@Clonkex You probably already figured this out, but `Quaternion.Inverse(a) * b` is b-aWed, 23 Jul 2014 21:12:43 GMTelliospizzamanComment by Clonkex on Clonkex's answer
http://answers.unity.com/comments/696245/view.html
@Mike 3 So is that a-b or b-a?Mon, 28 Apr 2014 04:13:12 GMTClonkexComment by hausmaus on hausmaus's answer
http://answers.unity.com/comments/633615/view.html
Thank you, people smarter than me!Thu, 06 Feb 2014 19:36:25 GMThausmausComment by Khada on Khada's answer
http://answers.unity.com/comments/492944/view.html
Thank you! That took far too long to find X_XSun, 14 Jul 2013 17:41:51 GMTKhadaComment by Favo-Yang on Favo-Yang's answer
http://answers.unity.com/comments/321362/view.html
Very handy!Sat, 22 Sep 2012 06:03:20 GMTFavo-YangComment by Mahamed9628 on Mahamed9628's answer
http://answers.unity.com/comments/233731/view.html
Thanks! It helped me too. I used to have headache from some problem with planets, and had been suffered with that for weeks, and with this solution anything got to work. Thanks again.:)Fri, 30 Mar 2012 08:44:14 GMTMahamed9628Comment by Mike 3 on Mike 3's answer
http://answers.unity.com/comments/89029/view.html
Oh strange, I tested that like 5 times, I must have had a thinko when I wrote it in here. Fixing it nowSat, 27 Nov 2010 17:50:58 GMTMike 3Comment by robinking on robinking's answer
http://answers.unity.com/comments/89027/view.html
Nearly! I tested it both ways and it's actually the other way round - "Quaternion relative = Quaternion.Inverse(a) * b;" works a charm. Thanks! I'll tick this answer, maybe you could update it?Sat, 27 Nov 2010 17:23:24 GMTrobinkingAnswer 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