Whats the Difference Between Rotation EulerAngles and Quaternions?

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. :)

more ▼

asked Feb 21, 2011 at 01:23 AM

avatar image

789 75 76 108

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Feb 21, 2011 at 01:44 AM

avatar image

Peter G
18.4k 34 87 218

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 :)

Feb 21, 2011 at 02:12 AM NinjaSquirrel

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).

Feb 21, 2011 at 11:33 AM Jesse Anders

Thanks Jesse. As I said, I only know the very basics so I appreciate the help.

Feb 21, 2011 at 02:31 PM Peter G

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.

Feb 23, 2011 at 05:41 PM Cawas

Oh, and here's a glimpse of how nearly incomprehensible quaternions are, through a video: http://www.youtube.com/watch?v=lwB7KzG9awk

Feb 23, 2011 at 05:56 PM Cawas
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Jan 29 at 02:48 PM

avatar image

1 1

Engineering FTW indeed.

If you understand Vectors and you get Complex Numbers, Quaternions are not much of a step further.

Jan 29 at 03:00 PM meat5000
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Feb 21, 2011 at 01:23 AM

Seen: 6933 times

Last Updated: Jan 29 at 03:01 PM