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 user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
1 Person is following this question.
Rotation Jumping values (0 to 180)
eulerAngles not set to zero.
Problem in Euler angles
Rotation around z-axis always local space and not world? Vector-axis angle projection calcuations.
Precise rotation based on joystick axis input for twin-stick controls