x


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

NinjaSquirrel gravatar image

NinjaSquirrel
774 74 72 103

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

1 answer: 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

Peter G gravatar image

Peter G
17.6k 29 63 163

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

By RSS:

Answers

Answers and Comments

Topics:

x3490
x711
x222
x87

asked: Feb 21, 2011 at 01:23 AM

Seen: 5956 times

Last Updated: Feb 21, 2011 at 02:31 AM