Hello all,

What i want to learn is not “to rotate” but “to check” a local axis rotated degrees.

To clear the question a bit:

I have a steering code based on rigidbody. When I start rotating the object ,i want it to stop, when the X (or -X) degrees have been achieved in one axis.

As i see euler angles are somewhat write only angles, and quaternion angles are a bit complicated for me to grasp.

Also angles are going from 0 to 180 but i want X to be infinite. Like i want to enter 780 and want to check if it completed the 780 degrees of rotation in one axis.

This is something i have been reading for some time but couldn’t find a good way for this. If there is any link regarding this issue that would be great also.

You should keep an auxiliary angle measurement, since reading Euler angles isn’t reliable (as you already noticed). If you rotate only about X, things are easier: measure the angle between the current forward direction and the previous one, and accumulate it in the auxiliary angle variable. The angle can be measured with Vector3.Angle, but unfortunately this function always return a positive value - you must find its polarity with Vector3.Cross, like below:

```
private var lastFwd: Vector3;
private var curAngleX: float = 0;
function Start(){
lastFwd = transform.forward;
}
function Update(){
var curFwd = transform.forward;
// measure the angle rotated since last frame:
var ang = Vector3.Angle(curFwd, lastFwd);
if (ang > 0.01){ // if rotated a significant angle...
// fix angle sign...
if (Vector3.Cross(curFwd, lastFwd).x < 0) ang = -ang;
curAngleX += ang; // accumulate in curAngleX...
lastFwd = curFwd; // and update lastFwd
}
}
```

NOTE: Accumulating the angle over time may also accumulate small errors that eventually will become noticeable.