4 ms·
When I rotate screen to landscape on my Android using Chrome 40.0.2214.89, it says North is about pi/2 anti-clockwise from where it says North is when my screen
by Robadob 12y ago
When I rotate screen to landscape on my Android using Chrome 40.0.2214.89, it says North is about pi/2 anti-clockwise from where it says North is when my screen is portrait. Presumably It's not accounting for screen rotation.
- moron4hire 12y agoSo, this is something that is not explained well with Device Orientation API. It's meant for holding your phone flat in your palm, parallel to the ground. In that orientation, the heading is reported relative to the top edge of the device. It can work in a landscape orientation, but at that point that top edge of the device is now pointing 90 degrees in the wrong dejection from what you probably intend, i.e. the back plate of the device. And in a portrait orientation, it completely gimbal locks. For that very reason, I wrote this: https://github.com/capnmidnight/Psychologist.js/blob/master/html5/js/input/MotionInput.js https://github.com/capnmidnight/Psychologist.js/blob/master/...