Search Unity

Question Tracking Lost after switching between face tracking and world tracking

Discussion in 'AR' started by ShakingEarthDigital, Sep 30, 2020.

  1. ShakingEarthDigital

    ShakingEarthDigital

    Joined:
    Mar 20, 2014
    Posts:
    7
    My setup is this:
    1. I have a world tracking scene
    2. I then transition to a non-AR scene
    3. I then transition to a face tracking AR scene
    4. I then transition back to the world tracking scene

    At step 4, tracking seems to be lost, and I can't recover it. My objects are essentially 'stuck to the camera' as they don't stick to the world. The camera stream is still working (not black, like in some other posts). The tracking is NOT lost if I go to step 2 and then back to the world tracking scene.

    Things I've tried:
    I've tried deleting and re-creating the ARSession object.
    I've tried calling Reset on the ARSession object.
    I've tried going to an empty scene between steps 3 & 4.

    Each scene has its own ARSession & ARSession Origin objects.
    I'm using ARFoundation4. Testing on an iPhone XR.

    Help?
     
  2. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    This appears to be a bug in ARKit (specifically iOS 14) and is reproducible in a purely native project (i.e., outside of Unity). It happens when ARFaceTrackingConfiguration.worldTrackingEnabled is true (this uses the user facing camera with 6 degrees of freedom), and the configuration is subsequently changed to an ARWorldTrackingConfiguration (world facing camera).

    It does not happen when ARFaceTrackingConfiguration.worldTrackingEnabled is false. In ARFoundation, this corresponds to an ARSession.requestedTrackingMode of "Rotation Only".

    As a workaround, when you switch to the user-facing camera, also change the ARSession.requestedTrackingMode to RotationOnly. When you switch back to world facing camera mode, you'll want to make sure you also switch the requestedTrackingMode back to PositionAndRotation.

    Note that older devices, like the iPhone X, do not support the "Position and Rotation" tracking mode while in a user-facing camera mode, so you will only see this situation on newer devices like the iPhone 11.
     
  3. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,144
  4. ShakingEarthDigital

    ShakingEarthDigital

    Joined:
    Mar 20, 2014
    Posts:
    7
    Confirmed both posts! It is indeed an issue with iOS 13 as well, but the fix works either way. I turned tracking to Rotation only for the face tracking AR scene, and tracking in the world tracking scene resumed perfectly fine.

    Thank you!
     
    KyryloKuzyk likes this.
  5. MdevM

    MdevM

    Joined:
    Sep 28, 2017
    Posts:
    43
    I've run into the same issue, unfortunately, with RotationOnly, the face tracking acts slightly differently and it's enough to throw off my app compared to AR Foundation 3.

    Does anyone know of any other options for me? I'm pretty sure AR Foundation 3 isn't compatible with anything after Unity 2019.
     
  6. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    199
    @MdevM Yes, there is no further support for AR Foundation 3 and Unity 2019.

    But if you're having issues in a supported version your best option would be to file a bug report from inside the editor.