ACBurk
ACBurk

Reputation: 4428

iPhone Compass: Adjust Heading to get Correct Reading in Landscape

Does anyone know how to adjust the iPhone's compass reading to adjust if you use it in landscape mode? The heading is always taken from the top of the device, but a true reading should be available if recalculations are made with the accelerometer data.

Upvotes: 1

Views: 1691

Answers (1)

Alex Taylor
Alex Taylor

Reputation: 7168

I find the best way is to offset the heading by the number of degrees of tilt of the X axis.

I.e. straight up (home button at bottom), offset is 0. Tilt 90 degrees to right, add 90 degrees etc.

This will give you the correct heading to within ~3 degrees

Source: I'm making an AR satellite tracking app for the iPhone 3GS currently.

Upvotes: 2

Related Questions