top | item 39390339

(no title)

hollander | 2 years ago

When i hold it upwards isFlat becomes false, but when i hold the phone upwards in landscape mode isFlat stays true. Why do i need to keep the phone flat? Doesn't that depend on the rotation of the earth?

discuss

order

LoganDark|2 years ago

Pure speculation: Because the iPhone only has an Earth compass, the app has to calculate which direction to point based on the position of the Earth (relative to the Milky Way), the iPhone's built-in compass, and world position. Which means the phone has to be perfectly flat or else the calculation will be off.

I think there are ways to use the other sensors to more accurately estimate the phone's orientation even when it's not perfectly flat, but maybe this developer just didn't get around to it.

genmon|2 years ago

Good guess! I can only find deviceHeading as is a projection of the north vector onto the long axis of the device. When the phone is orthogonal to north, that becomes unreliable. What I really need is the north vector, real-time updated, relative to the device itself, no projection. I might be missing this? The iOS SDK is big and this is my first app, so pointers very welcome.

tocs3|2 years ago

I would think an iPhone would have a 3 axis magnetometer and 3 axis accelerometer to sense the phones orientation (and 3 axis gyro). The magnetometer would be where the compass functions would come from.