开发者

calculating angle - android

开发者 https://www.devze.com 2023-02-19 02:10 出处:网络
I\'ve been trying to figure this out, but with no luck. I want to calculate the angle between the phone\'s orientation and the y-axis, when rotating the phone around the z-axis. I\'m holding the phon

I've been trying to figure this out, but with no luck.

I want to calculate the angle between the phone's orientation and the y-axis, when rotating the phone around the z-axis. I'm holding the phone in front of me and tilting it from portrait orientation towards landscape landscape orientation, with the y-axis running through the center of the earth. Now I want the angle o开发者_开发知识库f the tilt. I had made a picture explaining what angle I need, but I needed more reputation to post images...

Now I want to know what sensor type to use and which value. In my tries I haven't been able to isolate just that specific angle. The closest one I got was TYPE_ROTATION_VECTOR with value[2] but I didn't get that to work fully, and besides, you needed api level 9 for that.


What you need is SensorManager.getOrientation()

0

精彩评论

暂无评论...
验证码 换一张
取 消