I am very iffy over the three, could someone point out all the differences and uses of them, in dumb terms so I can understand it? Thanks. :)
Answer by Peter G
Feb 21, 2011 at 01:44 AM
Euler angles are what most people think of when the picture 3d space. Each value represents the rotation in degrees (it could technically be in any units) around one of the 3 axises in 3d space. Also note that Euler angles are the ones displayed in the inspector assuming you are not in debug mode. Most of the time you will want to create angles using eulers because they are conceptually the easier to understand. The flaw is that Euler angles have a problem known as the gimbal lock that prevents certain rotations when two axises align. The solution: quaternions.
Honestly, I don't know what quaternions are. The are a 4 component value represented as (x,y,z,w) and they don't have the problem that Euler angles have. The definition is here, and if you can understand it, then you're a smarter person than me :). It looks like x,y,z,w and are the coefficients of 4 terms in a quaternion. (Over my head)
There are almost 0 instances when you will want to manipulate the values in a quaternion individually, so you really don't need to know how they work unless you plan on creating your own engine, Unity abstractifies most of it away. Instead, use the methods Unity provides and know that the * operator will put the 2 together.
I would recommend learning Euler Angles, they are easy to understand, and very valuable. You can learn how Quaternions work if you want, but you can do almost everything you need to without directly manipulating them. Instead use functions such as Quaternion.Euler() or Quaternion.LookRotation which generates the quaternion for you from a given degree measure or direction.
God, that is some crazy physics crap! I definitely need to take that physics class at my high school sooner or later. Oh well, thanks anyways. That gave me a lot to thank about and research when I fell like it :)
One small correction: quaternions are not 'the solution' to gimbal lock. Quaternions don't prevent gimbal lock; in fact, it's just as easy to run into gimbal lock with quaternions as with matrices. What does prevent gimbal lock is not building your orientations in a way that is subject to gimbal lock (which generally means not using 'from scratch' Euler angles).
Thanks Jesse. As I said, I only know the very basics so I appreciate the help.
Even if you do know how Quaternions work, don't ever directly manipulate them as it will make your code unreadable to 99% of the community, including your colleagues.
Oh, and here's a glimpse of how nearly incomprehensible quaternions are, through a video: http://www.youtube.com/watch?v=lwB7KzG9awk
Answer by sirshelley
Jan 29, 2015 at 02:48 PM
Hello from the future and anyone else. Incase you don't want to go and spend a few hours working out the maths proof: In summary quarterion avoids gimble lock as you can never have an angle overlap due the relationship between imaginary and real - you simply get an error or 0 if you try to force an overlap as it literally removes one of the required arguments for the function.Like with lots of maths concepts it appears there is a consensus to confuse rather than explain. P.s Engineering FTW.
Engineering FTW indeed.
If you understand Vectors and you get Complex Numbers, Quaternions are not much of a step further.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
2 People are following this question.
Set rotation based on 1,1,1 style vector? How to convert vector3 to quaternion?
Using Quaternion.LookRotation( ) on y axis only, but keep x axis of transform the same?
How do I rotate a game object in 45 degree steps per keystroke?
Rotation problem while dynamically changing animations
Quaternion distorts my object