Answers for "Rotation quaternion to angular velocity"
http://answers.unity.com/questions/49082/rotation-quaternion-to-angular-velocity.html
The latest answers for the question "Rotation quaternion to angular velocity"Answer by Nimred
http://answers.unity.com/answers/890259/view.html
This is an old question but I couldn't find a good answer anywhere in Unity Answers, I thought I'd share what I figured out:
- The angular velocity is indeed the rotation axis, normalized, multiplied by the rotation speed in radians.
- Quaternion.ToAngleAxis(out angle, out axis) give a rotation's axis, and the angle IN DEGREES.
So in order to get an angular velocity from a Quaternion, you can do the following:
float angleInDegrees;
Vector3 rotationAxis;
myQuaternion.ToAngleAxis(out angleInDegrees, out rotationAxis);
Vector3 angularDisplacement = rotationAxis * angleInDegrees * Mathf.Deg2Rad;
Vector3 angularSpeed = angularDisplacement / Time.deltaTime;Sat, 31 Jan 2015 15:11:40 GMTNimredAnswer by hellcats
http://answers.unity.com/answers/49380/view.html
<p>The problem is that scaling the quaternion won't work because it will no longer be a rotation (it has to be unit length to represent a rotation). The Slerp function does something similar to what you want and is a clue. Here is Slerp:</p>
<pre><code>Slerp(q0, q1, t) = q(t) = (q1 q0*)^t q0
(q0* is Conj[q0], which is the inverse for unit length quaternions)
</code></pre>
<p>This interpolates between two rotations q0 and q1 with t varying from [0, 1].
So if you think of t as being time, then the time derivative dq/dt is:</p>
<pre><code>Log[q1 q0*] (q1 q0*)^t q0
</code></pre>
<p>also,</p>
<pre><code>dq/dt = 1/2 w(t) q(t)
</code></pre>
<p>Note the equivalent form, the Log[q1 q0*] part of dq/dt matches with 1/2 w(t), so the angular velocity is:</p>
<pre><code>2 Log[q1 q0*]
</code></pre>
<p>For unit length quaternions this evaluates to</p>
<pre><code>2 v / ||v|| ArcCos(s)
</code></pre>
<p>where quaterion q is (s, vx, vy, vz) (i.e. s is the scalar part and v the vector part)</p>Fri, 25 Feb 2011 03:19:59 GMThellcats