Hello!
I’ve been porting a game that uses the gyroscope input from Android to Windows Phone.
After setting “Input.compensateSensors = true”, Input.gyro.attitude started returning the same values as an Android device, but it seems Input.gyro.gravity is swapping the x and y axes. I’ve been trying to rectify the data with some basic math but I am not able to wrap my head around the rotations and gyroscope data.
I’m using Unity 4.5.1.
My game uses Portrait mode but I still tried setting the axes as you suggested to no avail. Every time I rotate the device along the Y axis, the gravity changes as if I rotated it along the Z axis.
I am not sure if it is a bug or if I need to do something else to get the correct readings. I have reported a bug just in case.
In the meantime, I made an ugly workaround:
I made an invisible object and attached this script to it, I get the inverse of the resulting rotation (because the script was meant to be attached to a camera). Then I just ask for the down vector of this object.
Please let me know if there is something I’m missing in order to fix this issue or if there are simpler workarounds.