Search code examples
androidpositionorientationtargetvuforia

Vuforia on Android mirrors target position after orientation change


I used VideoPlayback as the base of my application.

I use SCREEN_ORIENTATION_SENSOR_LANDSCAPE on both vuforiaAppSession.initAR and activity orientation.

If I start my application as landscape_left, it works fine, if I start it as landscape_right, it also works fine, but if on runtime I change the orientation, the positioning of the target ( where the video is supposed to be ) is mirrored, like it was -x and -y instead of x and y.

I looked everywhere for people having the same problem, but failed.

This is the closest I found, but I cannot think why it worked for him: https://developer.vuforia.com/forum/android/does-vuforia-287android-support-live-screen-orientation-rot

Thanks!


Solution

  • onConfigurationChanged isn't called for SENSOR_LANDSCAPE, so I had to add a SensorManager to check orientation change and put vuforiaAppSession.onConfigurationChanged() inside of it.