mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

Bad Values for Orientation & Heading

Open Schmiggolas opened this issue 3 years ago • 4 comments

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: Screenshot 2021-08-17 152015

And here's the DefaultLocationProvider: Screenshot 2021-08-17 152036

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

Schmiggolas avatar Aug 17 '21 13:08 Schmiggolas

Could you provide a screenshot of the LocationProviderFactory. It's important to know which references are set for android

Markovicho avatar Aug 23 '21 07:08 Markovicho

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).

LEL

Schmiggolas avatar Aug 28 '21 17:08 Schmiggolas

image

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.

Markovicho avatar Aug 28 '21 17:08 Markovicho

Thanks for the tip! I'll definitely try that.

Schmiggolas avatar Aug 29 '21 16:08 Schmiggolas