How to get Android phone orientation matching human orientation?

后端 未结 4 1377
有刺的猬
有刺的猬 2021-01-31 17:30

I\'m making a map app, including the location arrow that shows you which way you\'re facing, like so:

\"Map

4条回答
  •  鱼传尺愫
    2021-01-31 17:47

    This looks pretty tricky. I'm developping a PNS for Android and am facing a somehow similar problem for which I'm still in need of the light : How to get the rotation between accelerometer's axis and motion vector?

    Thing is that it looks to me absolutely impossible to find which direction the user is facing (not the device) if he's not moving. That is the human has no sensor on his body, so what if the device stayed in the absolute same position but the user rotated by 90° ? I don't see any way to find this.

    What I can suggest (and that fits actually to my problem) is that you could (I don't know what you actually do in your code) use the motion of the user to determine his heading. Let me explain. Let's say you have a first position A. User goes to B. Then you can build the AB vector and get the heading of the user when he stops at B. You'd then have to limit your code to the direction he is facing when arriving to destination.

    I know this is not as good as what Google Maps gets, but do you know what Google uses for this ? I mean do they only use accelero and mag.field sensors ?

提交回复
热议问题