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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Feedback [bug?][ARFoundation] planes drift in the Y axis by +/- 2cm

Discussion in 'AR' started by enhawk, Jul 8, 2019.

  1. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    When tracking planes vertical position, as you move the camera around, they drift vertically by a few centimeters, in a bobbing motion.

    This is not apparent in Unity ARKit Plugin, seems to only happen in ARFoundation.

    Could this be due to auto-focus? Or new points being added?

    If you spawn a cube using the place on place scene (with a light that casts shadows), and move your device in and out towards the cube, the drift can be seen quite clearly.
     
    Last edited: Jul 9, 2019
  2. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    605
    I tested this using the Unity ARKit Plugin and I see the exact same behavior between ARFoundation and UnityARKit. However, it is more obvious in the ARFoundation Samples due to a few factors:
    1. In the ARFoundation SimpleAR scene, the cube is placed at a fixed position directly on the plane. This makes it quite obvious if the plane moves up or down as it covers or reveals the cube.
    2. Not sure which sample scenes you were comparing, but the UnityARKit scene UnityARBallz, for instance, places objects 3 centimeters above the plane.
    3. The balls in UnityARBallz are full rigid bodies, so they move up and down with the plane, making it difficult to detect minor movements.
    4. Even if you remove the rigid body component, the plane in UnityARBallz has a nearly transparent material, which makes it difficult to see when it intersects the placed object.
    When I removed the rigid body component from the ball prefab, placed it directly on the plane rather than 3 centimeters above it, and changed the plane's material to something more opaque, the results are the same as in the SimpleAR scene from ARFoundation.

    In addition, I would be quite surprised to find this sort of behavioral difference between the two SDKs. Neither UnityARKit nor ARFoundation manipulate the plane's position -- it is whatever ARKit tells us it is. Poor frame rate could affect tracking or plane detection fidelity, but both SDKs easily achieve a solid 60 fps.

    If this doesn't sound right to you, or you have more details on comparison you performed, please let me know.
     
  3. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    Hi @tdmowrer ,

    Your test is really helpful, thank you. I'm getting horizontal drift with arkit in arfoundation, is it reasonable to assume this is the expected behaviour? Full details posted on arfoundation git with video link

    thanks a ton for your help!
     
  4. BuoDev

    BuoDev

    Joined:
    Nov 28, 2018
    Posts:
    45
    Your tracking is fine. The problem is your model's pivot point is at the center of the model. Your need to offset the model so the feet of the model are level with the floor. Not they are going through the floor-
     
    Tarrag likes this.
  5. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    215
    That worked !! I really wouldn't have guessed @BuoDev ! Thanks a ton for sharing :)