Re-calibarting Compass

How do I re-calibarte the compass in a Unity app ?

That page says just move the phone in a figure 8 or rotate on all 3 axes. But are those apps doing anything in code when they ask you to do that ?

The calibartion on the default compass app on the iPhone seems much more involved. What are they doing exactly ? - How To Calibrate iPhone Compass Instantly - YouTube

Also, is there a way I can know when re-calibration is required ? Compass.headingAccuracy returns 0(meaning unsupported) on all android devices I’ve tried. I am not sure about iOS.

I’m looking into the same issue. In terms of how to calibrate, I think the idea is to “dislodge” the physical element that reacts to the magnetic field. Basically the figure 8 thing is just a reliable way to hit a while bunch of 3D rotations. I just kind of shake my phone around and toss it in the air to spin it, and that tends to do the trick. It’s a very inexact science

I’m looking into the accuracy thing, and have the same experience as you. I think it might be because Android uses 4 integer flags, rather than a “degrees off” kind of system.

I’m already using an Android plugin, so I think I’ll just have it forward the sensor.accuracy value through to Unity.