- Home /
Gyro calibration in android?
Hi, I have attached gyro script to my camera's rotation and rotation works fine till +-90 degree in left or right(x axis) and after that camera rotates to -y even if i move in x axis.
Here is code
void Start() {
camera.transform.eulerAngles = Vector3(90,90,0);
if (Screen.orientation == ScreenOrientation.LandscapeLeft)
quatMult = Quaternion(0,0,-0.7071,0.7071);
}
void Update() {
quatMap = Quaternion(gyro.attitude.w,gyro.attitude.x,gyro.attitude.y,gyro.attitude.z);
camera.transform.localRotation = quatMap * quatMult;
}
Comment
If would be great if you could post your gyro script, since we don't have to shoot in the dark to provide you solution. :-)