- Home /
Input.compass.trueHeading sucks!
Hi,
Input.compass.trueHeading / magneticHeading works like a charm if my phone lays on my table or if I hold the phone in a (lets say) normal 45° angle. My problem arises when I start to tilt the phone until the top of the phone points directly to the ceiling. Then it gets a lot less accurate and starts to flip flop between 2 values (e.g. 0 and 180, or 90 and 270).
I found a bugreport from a few years back that was denied:
Did anyone have a similar problem and found a workaround for this?
Cheers, M
Answer by michaelfelleisen · Aug 26, 2020 at 06:48 AM
My current workaround for this problem is looking up the phone rotation with Input.acceleration or Input.gyro.gravity and if the phone rotation gets to close to pointing straight up, I just ignore compass values.
Yeah, the gyroscope is way more accurate, and allows values greater than 180 so you shouldnt be flopping between 180 and 0 when pointing it directly upwards.