Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

ARFoundation - go to other app and back to AR app makes objects drift

Discussion in 'AR' started by newguy123, Nov 14, 2018.

  1. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,195
    Hi all

    I have a simple AR Foundation app. When run on either Android or iOS, place a 3d model on a plane all works well as expected. When the user however then minimizes the app/switch to a different app, then go back to the AR app, then the model suddenly starts drifting asif it doesnt know where things are in space.

    Am I suppose to somehow save the "state" of the app or how do I deal with situations like this?
     
  2. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    605
    When an AR app is backgrounded, it cannot track its position in the world, so when it is resumed, it has to re-establish tracking. This can result in an apparent drift as the device works out where it should be.

    In ARFoundation, you can provide different logic (e.g., hide place content) based on the ARSubsystemManager.systemState. "SessionInitializing" is usually when the device is trying to work out where it is, while "SessionTracking" means it is confident in its position.
     
  3. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,195
    @tdmowrer thanks I'll take a look at those and let you know what happens