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’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Bug XRtrackedImage.trakingState stuck on TrackingState.Tracking

Discussion in 'AR' started by fbergonzinigames, Jun 4, 2022.

  1. fbergonzinigames

    fbergonzinigames

    Joined:
    Apr 3, 2020
    Posts:
    12
    Hello, I'm having a bit of a hard time handling what appears to be an ARSubsystems bug to me.
    The bug occurs in this situation:
    1) I visualize (using the view images from my computer) a certain image (I will call it image1), previously inserted in the XRReferenceImageLibrary. Its trakingImage is generated and its internal state is rightly traking.

    2) I display a second image (image2), which appears exactly where image1 was, same size and same position (since I'm using the image standart pc view).

    3) The bug is that the traking state of the two images remains on traking even though image1 is no longer visible on the screen.
    This bug only happens when image2 immediately overlaps image 1 and remains in traking until I stop framing image2. It is as if the subsystem was unable to change traking state due to the speed of appearance of the new image in the frame.

    Any ideas on how to get around this problem?
     
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,036
  3. fbergonzinigames

    fbergonzinigames

    Joined:
    Apr 3, 2020
    Posts:
    12
    Thanks for the answers.
    I was informed that the TrakingState, especially the None is a little difficult to control at 100%. I structured my app so that the prefab is activated only when the image is in Traking and in other cases (Limited or None) I turn it off.

    My specific problem is that in the case I described, the traking state of the image should logically go to Limited or None (since it is no longer visible), but it remains in Traking and therefore the prefab remains active.
     
  4. fbergonzinigames

    fbergonzinigames

    Joined:
    Apr 3, 2020
    Posts:
    12
    One more thing, the prefabs that I instantiated as children of trakedimage have colliders that I use to manage raycasts. Could they be part of the reason for the bug?
     
  5. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    691
    On both ARCore and ARKit, when your image leaves the camera frame, the platform assumes that the image is static, and continues tracking the image's position relative to the movement of your phone. For this reason you might see the tracking state as tracking even if the image is out of frame.

    https://developers.google.com/ar/develop/augmented-images#moving-images

    "Once an image is detected, ARCore continues "tracking" the image's position and orientation, even when the image temporarily moves out of the camera view because the user has moved their device. In doing so, ARCore assumes that the image's position and orientation is static, and that the image is not itself moving through the environment."
     
    KyryloKuzyk likes this.
  6. fbergonzinigames

    fbergonzinigames

    Joined:
    Apr 3, 2020
    Posts:
    12
    Thanks for the answer, from what I understand so my problem is caused by an intrinsic feature of how ARCore and ARKIt works (I tried to use for example Vuforia and this bug does not appear). Any idea on how I could avoid it by staying in ArFoundatio then or is it something that cannot be fixed in your opinion?
    I make sure to post a video of the error so we understand each other.
     
  7. shivanshmywhoosh

    shivanshmywhoosh

    Joined:
    Feb 28, 2023
    Posts:
    4
    Any idea how can we solve this or any work around?
     
  8. shivanshmywhoosh

    shivanshmywhoosh

    Joined:
    Feb 28, 2023
    Posts:
    4
    Hey I have the same usecase, did you find any solution for it ?
     
  9. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    691