- Home /

# Quaternion lerp is not rotating my object to the desired rotation?

I have an object that I am trying to rotate to a certain rotation. The rotation I want is (0,0,90) that is based n the inspector when I try it manually.

```
DieRotations[0] = new Vector3(-90,0,180);
DieRotations[1] = new Vector3(180,0,90);
DieRotations[2] = new Vector3(180,180,0);
DieRotations[3] = new Vector3(90,0,0);
DieRotations[4] = new Vector3(0,0,90);
DieRotations[5] = new Vector3(0,0,0);
```

so I tried to this in my Update () method:

```
float speed = 0.01f;
Quaternion localRotation = gameObject.transform.localRotation;
Quaternion rotationTo = new Quaternion(DieRotations[4].x,DieRotations[4].y,DieRotations[4].z,0);
localRotation = Quaternion.Lerp(localRotation,rotationTo,speed*Time.deltaTime);
gameObject.transform.localRotation = localRotation;
```

This will work for certain angles, but in some cases it doesn't work. for example in this case it keeps going (as seen in inspector window) to (0,0,180)...

Any idea what I am doing wrong here? or why this is happening?

Thanks

**Answer** by iwaldrop
·
Jul 01, 2013 at 06:03 PM

It's probably because you're building your quaternion manually. Quaternion x,y,z is not what you probably think (unless you really understand quaternions). If you're trying to build a Quaternion from a Vector3 you should use Quaternion.Euler

```
public Quaternion rotation = Quaternion.Euler(new Vector3(0, 30, 0));
```

Thanks, that fixed it, yeah I don't understand quaternions...so is the rotation we see in the inspector window, is that the Euler angles of the object or the localRotation ?

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