- Home /

# trouble with Quaternion rotation in 360 axis degree

Good day. I met a problem, with that rotation, exactly in 360 degrees by one of the axis. (in my case- yAxis) Here is a code, how I rotate my object

Quaternion followMouse = Quaternion.FromToRotation(Vector3.right, endPoint - startPoint); Quaternion newQuar = Quaternion.AngleAxis(90, Vector3.right); arrow.transform.rotation = followMouse * newQuar;

So, I got 2 point xPlane, getting angle in Quaternion, from last point to first, and after adding rotation by xAxis (that is always 90 degress) I got troubles only in 1 position, when get 360 degrees in yAxis rotation. At that moment my arrow starts to rotate in all axis by strange values, like 270, 90 degrees..

I found information, that it is kind of problem rotating with Quaternion, but how to solve that problem?

Hello,

What is the context of this issue? what are you trying to rotate, on what purpose? Because Depending on the situation different solutions could come up to perform a rotation.

And do you really have to use Quaternions?

In my case I working with world space UI. Here is example at picture 1 step - clicking and put 1st point 2 step - arrow following cursor. Here is going arrow rotation, and if I got 360 (or 0) degrees by y axis, I get that bug with rotations 3 step - mouse click and set 2nd arrow point

So, for sure I can use

```
transform.eulerAngles = new Vector3(90, followMouse.eulerAngles.y, 0);
```

but anyway, if I calculate rotation from

```
Quaternion followMouse = Quaternion.FromToRotation(Vector3.right, endPoint - startPoint);
```

I got a bug in 360 degrees position. At that point that is

```
Debug.Log: followMouse.eulerAngles.y: 1.332716E-05
```

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

Trying to tween the rotation of a cube in x and z and having trouble 2 Answers

Is there no way to get reliable angles from a rigidbody? 2 Answers

Object makes random jumps in rotation 1 Answer

Fixing the rotation around a particular axis using Quaternions? 2 Answers

Looping over cubic rotations? 0 Answers