Search Unity

Front camera tracking on iOS

Discussion in 'Vuforia' started by Khelgar, Jun 11, 2019.

  1. Khelgar

    Khelgar

    Joined:
    Mar 13, 2019
    Posts:
    16
    Hi everyone,

    I’m using Vuforia from few time and I have a problem with front camera tracking when I deploy my app on iOS. My problem is the camera image and the tracking are completely reversed. I will explain more my problem, so this is an image of what I have :



    To have a correct direction (on blue), I need to reverse top and bottom but the Vuforia logo will be reverse again. Send a correct image is not the main problem but I think it’s necessary to say that to have a good overview of my problem.


    My main problem is the following : I have a tracked image (image A) and I want to make another image (image B) on the tracked image. My tracking is doing with a central symmetry around the center of my background image.




    So if I move my tracked image to the right of the screen, my new image will go to the left of the screen (move 1 on blue). If I move my tracked image to the bottom of the screen my new Image go to the top of the screen (move 2 on red).



    So have you any solution to have a correct image orientation and a correct tracking with front camera ?
    It works correctly with back camera.

    I’m using Unity 2018.2.5, Vuforia 8.0.10 and iOS 12.0.


    Thanks for help :)
     
  2. Khelgar

    Khelgar

    Joined:
    Mar 13, 2019
    Posts:
    16
    Finaly fond a simple solution.

    Code (CSharp):
    1. BackgroundPlaneBehaviour m_bpb = FindObjectOfType<BackgroundPlaneBehaviour>();
    2.  
    3. if (m_bpb != null)
    4. {
    5.     m_bpb.transform.localRotation = Quaternion.Euler(new Vector3(180, -90, -90));
    6.     if (m_bpb.transform.localScale.x > 0)
    7.     {
    8.         m_bpb.transform.localScale = new Vector3(-m_bpb.transform.localScale.x, m_bpb.transform.localScale.y, m_bpb.transform.localScale.z);
    9.      }
    10. }