I’ve been looking at quaternions for a while and have gained a small understanding.
I hope that thie following will improve your understanding rather than confuse you, quaternions still confuse me. :spin:
If a is the angle of rotation and the quaternion follows (W, X, Y, Z) notation then the vector (x, y, z) about which the rotation occurs can be found simply by:
W = cos(a/2)
angle = a = 2 * arcos(W)
x = X * sin(a/2)
y = Y * sin(a/2)
z = Z * sin(a/2)
My understanding is that X, Y, Z are the strength of rotation about an axis and that W is the influence of the original orientation. To rotate about an axis, both the strength of the rotation about that axis must increase and the influence of the original orientation must decrease.
Note that the angle of rotation is halved because quaternions have double cover over a rotation allowing for rotations of +/-360 degrees for a total measurable rotation of 720 degrees. It is this property that removes the possibility for errors through gimball lock.
It should also be noted that only unit quaternions are appropriate for use with 3d rotations and orientations. ie. sqrt(W2 + X2 + Y2 + Z2) = 1 where W**2 indicates W squared, etc.
1: I think that the actuator needs to be set/activated every frame.
2: Possibly, by applying the inverse of the quaternions from one side of the body to the other side. (Reverse the signs on each component of the quaternion)
3: As pointed out above, you need to reduce the W term as you increase any other term. Considering rotation about the x axis and remembering that the value is calculated from a/2…
No rotation, the identity quaternion, is (1,0,0,0)
90 degrees rotation is achieved by setting W to cos(45) and X to sin(45) --> quat = (0.707, 0,707,0,0)
180 degrees rotation is achieved by setting W to 0 and X to 1 (0 is cos(90) and 1 is sin(90) --> quat = (0, 1, 0, 0)
250 degrees rotation is achieved by setting W to cos(125) and X to sin(125) --> quat = (-0.707, 0.707, 0, 0)
360 degrees rotation is achieved by setting W to -1 and X to 0 (-1 is cos(180) and 0 is sin(180)) --> quat = (-1, 0, 0, 0)
4: I hope my other points have answered this one for you. If the quaternion that you’re using is not a unit quaternion the Blender is normalizing it internally since only unit quaternions are valid for representing rotations (I think this is how it works…) so your values will be changed. Try normalizing the quaternion that you’re using and see if this gives more predictable results.
Edit: I really hope this helped rather than confused you. I’ve found this to be the most helpful resource that I found on the subject.