List
Unity AR camera feed upside down on (some) Android devices
Posted Date: 2018-10-10 12:48     Edited Date: 2018-10-12 8:36     Writer: inactive

1. 3.5.1:
2. Unity Android (2018.2.0)
3. Tracker:
4. Free
5. Nexus 5x (OpenGL ES 3.2)
 

As described in the title, the camera feed is upside down on Nexus 5x but works properly on Samsung S6. 

The app runs only in portrait mode.

I've already tried to upgrade to the version 4 of the plugin and the latest Unity 2018 without success.

Posted Date: 2018-10-12 2:01     Edited Date: 2018-10-12 2:01     Writer: slkim

check your Unity Build Setting -> Resolution and Presentation->orientation.

but if not, check AndroidManifest.xml file in Plugin folder.

Posted Date: 2018-10-12 7:14     Edited Date: 2018-10-12 7:14     Writer: inactive

Hi slkim,

thanks for your reply, but as I wrote already, the app is running only in portrait mode (I've set this in the build settings already). I can check the AndroidManifest, but then what should I do?

 

The issue I'm facing is exactly the one reported in this post, looks like it's hardware related.

Posted Date: 2018-10-12 7:30     Edited Date: 2018-10-12 7:30     Writer: slkim

if that is hardware issue, see sample scene 'Camera Configuration'.

you can do vertical flip or horizontal flip for CameraBackground.

but you must make condition for Nexus 5x.

Posted Date: 2018-10-12 7:58     Edited Date: 2018-10-12 7:58     Writer: inactive

That's actually what I've tried. I flipped the CameraBackground, but now the trackable is also upside down. 

If I try to rotate the trackable by 180 degrees, then the tracking is flipped and the trackable rotates in the wrong direction.

I guess I should do something with the poseMatrix, I tried to get the inverse but it's not working. I don't know what to try next.

Posted Date: 2018-10-12 8:36     Edited Date: 2018-10-12 8:36     Writer: slkim

You try pose matrix multiply scale x(-1,0,0). 

do add this code at ImageTrackerableBehaviour function OnTrackSuccess.

public override void OnTrackSuccess(string id, string name, Matrix4x4 poseMatrix)
{
Renderer[] rendererComponents = GetComponentsInChildren<Renderer>(true);
Collider[] colliderComponents = GetComponentsInChildren<Collider>(true);

// Enable renderers
foreach (Renderer component in rendererComponents)
{
component.enabled = true;
}

// Enable colliders
foreach (Collider component in colliderComponents)
{
component.enabled = true;
}
Matrix4x4 matrix = Matrix4x4.identity;
matrix[0] = -1;


poseMatrix = matrix * poseMatrix;
transform.position = MatrixUtils.PositionFromMatrix(poseMatrix);
transform.rotation = MatrixUtils.QuaternionFromMatrix(poseMatrix);
}