mapbox-unity-sdk
mapbox-unity-sdk copied to clipboard
Bad Values for Orientation & Heading
We're building a "Augmented Audio" App for smartphones where we need reasonably accurate values for our user heading. Basically, we're currently experiencing really weird behaviour with both heading and orientation. It's not just the values being wrong (like some sort of offset for example) but values being inconsistently wrong. If I do a 90° turn to the left our player target might turn 45° left OR 180° right or anything else really. It's also dependent on which device I use.
I tested everything that could be reasonably expected to have an impact on this but couldn't quite figure out the problem. The problem is really bad when using device orientation. When that's off it's better but still not perfect (and we need orientation to work anyways)
Here's the RotateWithLocationProvider
component:
And here's the DefaultLocationProvider
:
Anyone here having any suggestions on how to tackle this problem or some sort of "best practice" which I could try?
- Unity version:
- Scripting Runtime Version: 2019.4.22f1
- Scripting Backend: Mono
- Api Compatibility Level: .NET Standard 2.0
- Mapbox SDK version: 2.1.1
- The platform you're building to: Android
Could you provide a screenshot of the LocationProviderFactory. It's important to know which references are set for android
Sure!
We've managed to build a workaround by simply using Unity's Input.compass
API. The values we get there are jittery without smoothing but it works fine. So it must be something on your guys and gals end (or far more likely, I misconfigured something lol).
Try this setup and leave the custom android provider empty. It will use the defaultlocationprovider also for android instead of this native class which was also not working well for me.
Thanks for the tip! I'll definitely try that.