Orienting Filament camera with Android rotation vector #7669
Unanswered
rayyymmonnddddd
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone,
I'm building an AR experience on Android that projects stars in the sky and users can see them when they point their phones upwards. The stars should stay in the same spot from the users point of view (for simplicity's sake, I'm assuming the users are staying in the same spot).
Problem
For the most part it seems to work fine when I hold the phone upright. However when point upwards at the stars and I rotate the phone to its side (portrait to landscape), the stars would rotate away instead of staying in place.
This sounds like a common problem but I'm having trouble figuring out how to fix it with my limited knowledge of quaternions and 3D space - hoping someone here can help 🙏
How am I implementing it?
I'm utilizing Android's rotation vector sensor and retrieving a quaternion that represents the phone's current orientation in Android's own coordinate definition:
To achieve the AR effect, I'm following these steps:
setModelMatrix
Here's the code:
Beta Was this translation helpful? Give feedback.
All reactions