![](/img/trans.png)
[英]How do I get the correct bearing (magnetic orientation) regardless of screen orientation?
[英]How can I get the compass bearing regardless of device orientation?
我正在嘗試創建一個需要我找到羅盤方位的應用程序。
用戶將握住他們的設備,使屏幕始終面向他們,但可以將其旋轉 360 度。
我可以成功地確定一個方向的方位——縱向或橫向——但我需要找到一種方法來確定方位而不考慮旋轉。
我可以這樣做嗎?
謝謝。
您應該使用可以完全確定設備角度的陀螺儀數據。
您會發現此鏈接很有幫助: http : //www.touchqode.com/misc/20101025_jsug/20101025_touchqode_sensors.pdf
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.