I'm working on a mobile game in Unity and using the gyroscope to rotate an object along the x and y axes.
float x = Input.gyro.attitude.x; float y = Input.gyro.attitude.y;
This code give me the rotation I want when pointed in a certain direction along the z-axis. I want the rotation to not depend on the z-axis. I want the rotation to act the same no matter what direction I'm pointed in the real-world.
Here is a 12 second clip of what I get using a mobile gyroscope when pointed at 1 or North on the z-axis:
I want the rotation to be the same no matter what direction I am pointed on the z-axis with the gyroscope. Is there some way to rotate the whole coordinate system?