compass.trueHeading/compass.magneticHeading It gives values between 20 to the crazy.

Hello, I am trying to rotate an object on a 2D map according to where it is looking in real life with a phone, I try to do it with the compass, but the problem is that magneticHeading or trueHeading gives me values between 20 values constantly changing like crazy, for For example, if I leave my cell phone fixed in one place, it will vary from 260 to 280 constantly, changing in milliseconds crazy, is it something I am doing wrong? or what can be the problem?, I guess this should not be so. Thanks.

If I were you I’d stabilize the input data by using a sliding average of the data from the previous ~20 or ~50 frames.

Thanks for your answer!, but… I don’t quite understand what you mean :(, can you help me a little? Thanks :slight_smile: