- Home /
Question by
$$anonymous$$ · Jul 08, 2018 at 07:16 PM ·
animationvrgyroscope
GyroScop problem
At initial position gyroScop script is work perfectly but when i press ui button using GazeInput and switch to another place at the same scene via camera animation, the gyroScript does not respond.
I created empty GameObject and the MainCamera put on empty gameObject. script is written below that is attached to MainCamera.
private Gyroscope gyro;
void Start ()
{
if (SystemInfo.supportsGyroscope)
{
gyro = Input.gyro;
gyro.enabled = true;
}
else
{
Debug.Log("Phone doesen't support");
}
}
void Update ()
{
GameObject player = GameObject.FindGameObjectWithTag ("Player");
player.transform.Rotate (-Input.gyro.rotationRateUnbiased.x, -Input.gyro.rotationRateUnbiased.y, 0);
}
void OnGUI()
{
GUILayout.Label ("Gyroscope attitude : " + gyro.attitude);
}
i will appreciate your help!!
Comment