- Home /
Android Gyro explanation?
Hi,
I have a basic gyro script that allows users to look around using the camera. The initial quaternion.identity, however, is always north by default, it seems, and I have to turn to my left to get an accurate default rotation. Is the gyro.attitude informed by the compass? What would be the solution in this case if so; an initial offset, I assume?
Thanks for any and all answers
Answer by AndrewRyan · Jul 06, 2017 at 12:34 AM
Turns out what I wanted was gyro.rotationRateUnbiased.
transform.Rotate (-Input.gyro.rotationRateUnbiased.x, -Input.gyro.rotationRateUnbiased.y, Input.gyro.rotationRateUnbiased.z);
and not gyro.attitude.
//transform.localRotation = gyro.attitude * new Quaternion(0,0,1,0);
Answer by Vollmondum · Jul 05, 2017 at 02:20 PM
Set your player's rotation at start as you'd like, placing gyro inside playerObject. After it's loaded, unparent and reassign where you want it to. If it's always north, local rotation only, so being childed it looks Z = 0.