Closed domvon closed 6 years ago
Hi @domvon, currently we don't expose this API. But I added this to our backlog and will update this issue when we launch it.
Yes, exposing this would be amazingly useful for any GPS-based app. Otherwise these apps cannot align the Viro axes to the real-world axes, unless there is another way to do this that is escaping us. Thx.
Btw, Unity lets you find the true north heading, in relation to the Unity world space. If we could do that in Viro, this could be another way to solve the world alignment problem. Looking forward to hear your thoughts on this. Thx.
Hi @domvon,
Since we're based on React Native, you can consider using something like this custom module that gives you the user's current heading: https://github.com/yonahforst/react-native-heading which comes from the device's compass. With that information, you can then rotate your world by the inverse of that heading to align your objects North.
Let us know if you need help with that (there are also a few other community-built compasses).
Andy
Thanks, but that heading would only be valid if obtained exactly at the time the Viro world space is initialized, and only if its accuracy is good. After that the device will likely have moved around, and any heading info has no relation with the Viro world space anymore, and so we don’t know by what angle to rotate the Viro world space. Does that make sense? Maybe I am missing something...Thx
Hi @domvon,
Sorry for the delayed response.
You can also try to use it in conjunction with the getCameraOrientationAsync
call here: https://docs.viromedia.com/docs/viroarscene#methods which will return you the camera's current orientation. Then if you take the 'y' rotation in conjunction with the heading, then you'll get your offset from the original rotation.
Andy
Hi @domvon,
Our latest release (https://docs.viromedia.com/docs/releases) now has this feature:
See the worldAlignment
prop on the ViroARSceneNavigator
(iOS only): https://docs.viromedia.com/docs/viroarscenenavigator#props
Let us know if you have any other issues!
Hi @achuvm , we just saw that, this is awesome! Thanks so much!
No problem!
We're looking forward to seeing what you build with the platform!
Closing this issue as solution was provided in latest update.
Hello, excellent discussion here. Is there a way of getting the same alignment reference on Android?
Hi how can be te worldAligment feature reached on Android device?
+1, how can this be achieved on Android?
Is there a way to initialize the Viro AR experience to be like ARKit's ARConfiguration.WorldAlignment = gravityAndHeading , aligned to North-South? Is this exposed in some way, at least for iOS? Thx.