Comments and answers for "combine / convert rotations (Quaternion and Vector3)"
http://answers.unity.com/questions/275385/combine-convert-rotations-quaternion-and-vector3.html
The latest comments and answers for the question "combine / convert rotations (Quaternion and Vector3)"Comment by Wolfram on Wolfram's answer
http://answers.unity.com/comments/275588/view.html
The x/y/z/w quaternion notation has no simple/obvious "real world" representation, most notably the "x/y/z" is not directly related to actual X/Y/Z axes/rotations, it's just a way of accessing the Quaternion's members. You *can* convert a Quaternion into an axis+angle representation (where x/y/z would define the rotation axis, and w the angle around that axis), but that's not how quaternions are stored in Unity, and there is no trivial conversion (it involves asin/acos and sqrt).
If you *must* know, quaternions are represented in a 4-dimensional complex space :-P (and even that isn't the mathematically sound interpretation).Wed, 27 Jun 2012 17:17:18 GMTWolframComment by Owen-Reynolds on Owen-Reynolds's answer
http://answers.unity.com/comments/275553/view.html
The x/y/z of Quats is just book-keeping stuff, with no useful meaning. A Quaternion is a complete "rotation/facing," ready to be assigned to your rotation. You could think of a Quat as a magic wand waved over the vector you want to face, plus the extra "spin" around it (the wand part makes it count as a rotation.)
A vector _could_ be a way you want to be facing. If you use `Quaternion Q=Quaternion.LookRotation(V)`, then `Q` _is_ that facing (with your head spun "up".)Wed, 27 Jun 2012 16:17:39 GMTOwen-ReynoldsComment by weazel-art on weazel-art's answer
http://answers.unity.com/comments/275539/view.html
Thanks Owen, this worked perfectly, what you said about "building quaternion for each spin" only brings another question which is what is the difference between a quaternion and a vector (is it one is x,y,z, and one is x,y,z,w?)
Its something i will have to learn properly but a quick explanation would be grand, seeing as you understand that process clearly (as it worked a charm)
Thanks again, i now know you can multiply quaternions together to allow rotations on multiple axis ^_^Wed, 27 Jun 2012 15:58:07 GMTweazel-artAnswer by Owen-Reynolds
http://answers.unity.com/answers/275519/view.html
This is an untested variant of a working "angled with ground, but my spin" merged with your code. The way `facingQ` is created/used is probably the most interesting part:
// your lerp to smooth into normal:
Vector3 newUpV=Vector3.Lerp(transform.up,surfaceNormal,Time.deltaTime*xRotSpeed);
// convert new up into a rotation:
Quaternion newUpQ=Quaternion.FromToRotation(Vector3.up, newUpV);
// your spinning:
Quaternion facingQ=Quaternion.Euler(0,curAngle,0);
// combine head tilt and spin:
transform.rotation = newUpQ * facingQ;
The problem with setting `transform.up` then `transform.eulerAngles` is that there's no good way to say "keep the work from the last instruction." Building quaternions for each local spin lets you combine them with `*`. In this case, `newUpQ` is the tilt that takes from facing North, head up, to still facing north-ish, but head tilted to the target. Then `*facingQ` adds a local y-spin.Wed, 27 Jun 2012 15:30:32 GMTOwen-Reynolds