Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location based compass orientation is incorrect. It always says North is direction when starting up. #590

Open
beachgrub opened this issue Dec 12, 2023 · 5 comments

Comments

@beachgrub
Copy link

Bug. There are similar issue but all marked as closed, incorrectly.

What is the current behavior?
Currently on iOS (Safari and Chrome tested) the simple location examples will always point the north cube in the direction the phone is facing after any interaction or started.
If the current behavior is a bug, please provide the steps to reproduce.
Load the basic example
https://github.com/AR-js-org/AR.js/blob/master/aframe/examples/new-location-based/basic-js/index.html
On iOS at startup there will always be several permissions popups. After hitting them all you will see the Red cube (North) in the direction of whatever you started. If you tap the cube or any cube, you will get a popup and then the orientation will reset so that direction is North and the Red Cube is there.

It is always happening with the included example. I put a copy on website at www.pasotours.com/location2

Please mention other relevant information such as the browser version, Operating System and Device Name
iOS (Chrome and Safari) it works correctly on android.
What is the expected behavior?

If this is a feature request, what is motivation or use case for changing the behavior?

@beachgrub
Copy link
Author

It looks to me like iOS no longer supports the compass deviceorientationabsolute event. It only supports the deviceorientation event and that seems to reset with the context in some way. In the basic example when you tap on a cube when it returns the device orientation resets with alpha = 0 regardless of the direction facing.
I believe on ios you now need to support the webkitcompassheading event to know which way the phone is facing absolutely.
https://developer.apple.com/documentation/webkitjs/deviceorientationevent/1804777-webkitcompassheading

@beachgrub
Copy link
Author

It appears that this is know. There was a MR that was not merged that seems to help but enabling the webkitcompassheading. #466

@nickw1
Copy link
Collaborator

nickw1 commented Apr 28, 2024

We really need developers who have an iOS device, this will help progress the iOS issues and allow the merging of #466.

Also see #278 and #603.

@nickw1
Copy link
Collaborator

nickw1 commented Oct 4, 2024

For additional context: this appears to be a known problem in some Android devices, so much so that the DeviceOrientationControls object has been removed from the offical three.js repository. Unfortunately it seems that for certain Android phones it may not be possible to obtain reliable North via the Web device orientation API. Hopefully this is only a minority of devices, though.

See: mrdoob/three.js#22613 and mrdoob/three.js#22654

@nickw1
Copy link
Collaborator

nickw1 commented Oct 18, 2024

Just an update on this: there is now a separate project for location-based AR (only) within AR.js where any future work to resolve, or find workarounds for at least (as they may be an inherent problem with the device), these kinds of bugs will be done:

https://github.com/AR-js-org/locar.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants