# ToAngleAxis Problem

I have 2 cubes and 1 gorund in scene.
At start,cubes are stand on the ground,and thire’s angle is 90 with the ground.

Cube A’srotation is tracked by gyro.

Cube B is the same as A,but when B 's angle is less than 35,B’s rotate will be stopped at 55(90 - 35)degrees.

My purpose is to limit the B’s rotation.

here is my code:

``````if (Input.gyro.enabled) {

A.rotation = Sensor.rotation;

Vector3 v1 = A.up;
Vector3 v2 = new Vector3(v1.x,0,v1.z);
float angle = Vector3.Angle (v1, v2);
if (angle >= 35) {
B.transform.rotation = A.rotation;
}
else {
float a;
Vector3 axis;
A.rotation.ToAngleAxis (out a,out axis);
Quaternion q = Quaternion.AngleAxis (55, axis);
B.transform.rotation = q;
}

}
``````

it works perfect in Editor through Unity Remote 5 with phone.

But when I build to the phone,it cause problem.

I check the output angle “a”,in Editor,it was limited at the range from 0 ~ 90.
But when I build to phone,it was different!
I rotate my phone 90 degrees,the value just changed 20 units.