Comments and answers for "Why does rotating via viewport give different values than inspector rotations?"
http://answers.unity.com/questions/54267/why-does-rotating-via-viewport-give-different-valu.html
The latest comments and answers for the question "Why does rotating via viewport give different values than inspector rotations?"Answer by jeffreylmeyer
http://answers.unity.com/answers/1280299/view.html
So how do we calculate the same values the inspector shows?
For example if I have Inspector values of:
Transform.rotation.x = 160 , .y =-30, .z=0
how do I get those values in C#?
The engine should provide that in a simple manner...
I'm guessing somehow they convert 0 to 360 into -1 to +1 ???
and what is the point?Mon, 05 Dec 2016 02:12:53 GMTjeffreylmeyerComment by Jesse Anders on Jesse Anders's answer
http://answers.unity.com/comments/107951/view.html
Hehe - I'm just glad I was able to get my point across :) (And in a tiny comment box, no less!)Tue, 29 Mar 2011 07:13:28 GMTJesse AndersComment by loopyllama on loopyllama's answer
http://answers.unity.com/comments/107939/view.html
ha! ok you win :)Tue, 29 Mar 2011 04:58:04 GMTloopyllamaComment by Jesse Anders on Jesse Anders's answer
http://answers.unity.com/comments/107839/view.html
Consider this example: q = qx*qy*qz, where qx, qy, and qz represent rotations about the x, y, and z axes. This example is subject to gimbal lock, even though quaternions are used. You might say, 'Well, of course; just don't combine them that way.' But that's exactly the point. You may understand the distinction, but many people believe (incorrectly) that quaternions are a 'magical' solution to gimbal lock, and they aren't. You can get gimbal lock with quaternions just as easily as with matrices. Do we at last agree on that? (Because that's really the only point I'm trying to make.)Mon, 28 Mar 2011 21:23:50 GMTJesse AndersComment by loopyllama on loopyllama's answer
http://answers.unity.com/comments/107826/view.html
quaternions cannot experience gimbal lock. period. :)Mon, 28 Mar 2011 21:03:48 GMTloopyllamaComment by Jesse Anders on Jesse Anders's answer
http://answers.unity.com/comments/107819/view.html
@psdev: harmless has it right about the interface. $$anonymous$$ost likely, orientations are converted from Euler angles to quaternion form and back again internally whenever it's convenient for the engine to do so, and any time this happens, the Euler-angle representation may change relative to what you expect (although the orientation itself does not change). Perhaps Unity could have used 'canonical' Euler angles, which might have avoided the 'changing angles' problem. But, aliasing is inherent to Euler angles anyway, and it doesn't seem unreasonable to me that this is reflected in the interface.Mon, 28 Mar 2011 20:30:28 GMTJesse AndersComment by Jesse Anders on Jesse Anders's answer
http://answers.unity.com/comments/107817/view.html
@harmless: The gimbal lock thing is more than can reasonably be covered in a comment, but the statement 'quaternions are free of gimbal lock' isn't entirely true (or at least is a little misleading). You can avoid gimbal lock without quaternions, and you can get gimbal lock with quaternions. Also note that quaternions and matrices have exactly the same behavior with respect to gimbal lock. (Gimbal lock is caused by composing rotations in a certain way, and is more or less unrelated to the intermediate representation used.)Mon, 28 Mar 2011 20:25:24 GMTJesse AndersComment by loopyllama on loopyllama's answer
http://answers.unity.com/comments/107651/view.html
and for clarity, quaternions are indeed free of gimbal lock. here is more info about gimbal lock with pretty pictures: http://en.wikipedia.org/wiki/Gimbal_lock#The_quaternion_solutionMon, 28 Mar 2011 10:23:19 GMTloopyllamaComment by loopyllama on loopyllama's answer
http://answers.unity.com/comments/107650/view.html
when you type in a rotation into the inspector you are entering an euler angle that gets converted to a quaternion internally. when you rotate in the viewport you are seeing the value change in the inspector that is a quaternion converted to an euler angle, which can and will "flicker" depending on the direction and amount of rotation.Mon, 28 Mar 2011 10:20:42 GMTloopyllamaComment by psdev on psdev's answer
http://answers.unity.com/comments/107633/view.html
Thanks for your clarification, and I'm sorry I'm being dense here. I think it's less of me debating Quaternions vs Euler and more contesting how the Unity Inspector IDE works unexpectedly (at least for me in comparison to Lightwave layout).
For example see the 2nd image above - why does the Y & Z change to -180 when all I did was rotate the X axis in the viewport?? is this an equivalent angle or something? Can't the IDE tell I only wanted to rotate X alone? Does my confusion make sense? Hope I don't run you out of characters again ;-)Mon, 28 Mar 2011 03:32:25 GMTpsdevComment by Jesse Anders on Jesse Anders's answer
http://answers.unity.com/comments/107610/view.html
Regarding display of Euler angles, although it's possible to display Euler angles in 'canonical' form and get more consistent results, it's not that important overall, I$$anonymous$$O. Aliasing is an inherent characteristic of Euler angles, and is just something that has to be expected when working with them. As for gimbal lock, quaternions don't really 'solve' the problem of gimbal lock, per se. Whether gimbal lock is a possibility is more a function of how your orientations are stored and manipulated. (That's a little brief, but I'm out of characters :)Sun, 27 Mar 2011 23:57:32 GMTJesse AndersComment by psdev on psdev's answer
http://answers.unity.com/comments/107564/view.html
Thanks, I appreciate your response, and I understand that 0,-360 and other multiples are the same thing - but I'm assuming it would be nice to have the viewport report consistent values. For example, why does undo report -360 when it was 0 a second ago? And isn't gimbal lock just dealt with by using Local vs World coordinates?
Also, can you address why if I want to constrain rotation to the X axis, why other Y & Z values change when using the viewport, but (correctly so) not via just entering a value in the X textbox? To me that is highly strange...?Sun, 27 Mar 2011 20:46:56 GMTpsdevAnswer by loopyllama
http://answers.unity.com/answers/54274/view.html
<p>You are viewing the rotation through euler angles, or an x y z in degrees. Internally the rotation is represented through quaternions which is 4 floats (these 4 floats are not simply angles or degrees). To answer your question a 0 degree rotation is the same thing as a 360 or -360 degree rotation...meaning your model is at the same angle, at that frame. You will see equivalent values "flicker" like this is the viewport because you are viewing the internal quaternion converted to an euler angle. Rest assured knowing there is nothing broken about this and it is normal. Quaternion's solve the problem of gimbal lock which plagues euler angles. </p>Fri, 25 Mar 2011 04:40:36 GMTloopyllama