- Home /
Problem with Gyro in Unity Android project
I would like to get a reference to Gyroscope
and retreive its rotationRate
.
Using code like this:
...
void Start() {
if (SystemInfo.supportsGyroscope) {
gyro = Input.gyro;
gyro.enabled = true;
}
}
void Update() {
if (gyro.enabled) {
Debug.Log("Gyro: " + gyro.rotationRate);
}
}
...
The problem is that SystemInfo.supportsGyroscope
returns false. gyro.enabled = true;
doesn't do the trick, since Gyroscope.attitude
keeps returning (0, 0, 0) object.
I am using Unity v5 along with Unity Remote 4, and have Dell Venue 7 connected for quick debugging. Everything worked fine just 2 weeks ago with Unity v4. Now, after upgrade it stopped working.
Answer by meat5000 · Mar 19, 2016 at 02:45 PM
Use accelerometer instead
https://unity3d.com/learn/tutorials/modules/beginner/platform-specific/accelerometer-input
Your answer
Follow this Question
Related Questions
How add gyroscope to UnityRemote for iPhone? 1 Answer
Android gyroscope 3 Answers
Strange android gyrometer attitude angles 1 Answer
Input.gyro.attitude returns zero values when tested with Moto G 4th generation device 2 Answers
How to setup android build so that users without gyroscope do not see it in Play Store ? 1 Answer