Search Unity

How to check ARKit world tracking quality

Discussion in 'AR/VR (XR) Discussion' started by konose, Mar 12, 2018.

  1. konose

    konose

    Joined:
    Oct 6, 2013
    Posts:
    4
    Hello!

    I am running into an issue where players are using my AR app in poorly lit environments and having really bad experiences due to ARKit not being able to keep its orientation accuracy. Is there a way I can retrieve some sort of tracking quality value from ARKit in unity that will allow me to display a message telling the user that the tracking is poor due to current environmental issues?
     
  2. ibrahimpenekli

    ibrahimpenekli

    Joined:
    Mar 10, 2015
    Posts:
    31
    Hi @konose ,

    You can check tracking quality as follows:

    Code (CSharp):
    1. private void OnEnable()
    2. {
    3. // Subscribe event
    4.     UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated;
    5. }
    6.  
    7. private void OnDisable()
    8. {
    9. // Unsubscribe event
    10.     UnityARSessionNativeInterface.ARFrameUpdatedEvent -= ARFrameUpdated;
    11. }
    12.  
    13. private void ARFrameUpdated(UnityARCamera camera)
    14. {
    15.     //camera.trackingState;
    16.     //camera.trackingReason;
    17. }
    Check detailed explanation about tracking state and tracking reason here.
     
    konose likes this.
  3. konose

    konose

    Joined:
    Oct 6, 2013
    Posts:
    4
    Thank you very much @ibrahimpenekli! This is exactly what I needed!
     
  4. slimanichaouki

    slimanichaouki

    Joined:
    Feb 22, 2018
    Posts:
    1
    Hello,

    In which script should this lines be placed ?

    Thanks in advance ;)
     
  5. ibrahimpenekli

    ibrahimpenekli

    Joined:
    Mar 10, 2015
    Posts:
    31
  6. jose-araujo

    jose-araujo

    Joined:
    Nov 17, 2016
    Posts:
    34
    Hi guys, I was wondering if there is an equivalent of the tracking quality when tracking a marker/reference image? I mean, if the tracking of that marker becomes worse, if we can have some way to understand that its degrading