- Home /

# When to use Quaternion vs Euler Angles?

This is a 'best practices' question as well as a clarification one. I get that Euler angles are a way to read Quaternions as a vector3 value, but when would you ever want to use Euler Angles? Why not just use Quaternions all the time?

I'm hoping to get some examples from everyone on when to use each of them, in order to help wrap my head around it by seeing it in practice. The simpler/cleaner the example the better but anything helps! Thank you!

**Answer** by rutter
·
Aug 07, 2014 at 02:42 AM

Quaternions have some advantages when it comes to gimbal lock and smooth interpolation. Their main downside is that they rely on advanced math -- math that even experienced developers often find difficult and confusing.

From the scripting manual:

[Quaternions] are based on complex numbers and are not easy to understand intuitively. You almost never access or modify individual Quaternion components (x,y,z,w); most often you would just take existing rotations (e.g. from the Transform) and use them to construct new rotations (e.g. to smoothly interpolate between two rotations). The Quaternion functions that you use 99% of the time are: Quaternion.LookRotation, Quaternion.Angle, Quaternion.Euler, Quaternion.Slerp, Quaternion.FromToRotation, and Quaternion.identity. (The other functions are only for exotic uses.)

People very rarely interact with quaternions directly. As it turns out, it's almost always easier to manipulate them using other representations:

Angle-axis representation specifies a unit vector and a rotation about that vector (see ToAngleAxis and AngleAxis pages).

Euler angle representation specifies rotation about the Z, X, and Y axes, in that order (see eulerAngles and Euler pages).

The scripting manual suggests some of the most common tricks for manipulating or generating quaternions.

There are some scholarly articles around the net, if you'd like to understand more about the math behind quaternions. If you plan on using them a lot, I highly recommend at least skimming some.

I recommend using quaternion variables to represent two things: an object's rotation, and/or a rotation which you'd like to apply to some object. Even when using them for that purpose, it's almost always easier to generate them using the methods described above, or by taking an existing quaternion and rotating it by some amount you just generated.

It's very rare that you need to actively examine or manipulate quaternions that you didn't create yourself. It's usually easier to use vector math to solve problems, including clever use of dot and cross products.

That was incredibly helpful. Thank you so much for the thoughtful response! I should have mentioned that yes, I have no intention in the immediate future of going 'inside' the quaternions - though maybe by Unity v16.0 I'll know how ; - D This definitely helps gives a much better vantage of the different methods and how/why to use them. Thank you!!!

Use a quaterion to copy a rotation.

```
Quaterion myQuaterion = transform.rotation;
otherTransform.rotation = myQuaterion;
```

Use euler angles to change or set up a new rotation:

```
rotation.eulerAngles = new Vector3(0, 30, 0);
```

By the time you have a PhD in mathematics to use quaternions directly you will no longer be interested in writing games.

Edit: Added example for euler angles

@BoredMorm, that looks like it would accomplish 99% of most jobs. Just curious when you might use a EulerAngle (if ever)?

You use euler angles for something like this:

```
rotation.eulerAngles = new Vector3(0, 30, 0);
```

Very difficult to set a specific angle with a quaterion

Both are different application. I tend to use eulerAngles far more often then I use quaternions.

You cannot represent rotations of greater than 180 degrees with Quaternions, and when doing a Slerp() or MoveTowards() rotation with Quaternions, the rotation always take the shortest path. So if you need to rotate more than 180 degrees, often EulerAngles are a better choice. Note you can use Quaternions for doing rotations of more than 180 degrees, but you have to play games that can make the code more complicate.

Note I've read a couple of claims that there are smoothness issues with Quaternion interpolation. I visually don't see it, but smarter people have argued the fact.

### Your answer

### Welcome to Unity Answers

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.

### Follow this Question

### Related Questions

EulerAngles value as floating point 1 Answer

Limit local Rotations on one axis 3 Answers

How to solve weird rotation problem? 1 Answer

Can't get eulerAngles to 180,180,180 1 Answer

LookAt script Issues 0 Answers