Search code examples
androidunity-game-engineaugmented-realityarcoreobject-tracking

Unity ARCore Object Tracking And Shifting Issue


I've been working on the following project: I have an android app made with unity with the ARfoundation librairy + ARCore plugin, the goal is to scan a QRCode (with Zxing) and summon a shelf at its position.
To instantiate the shelf, I launch a raycast right to the center of the qrcode I've scanned and when it hits an AR point, it should instantiate the shelf.
It actually works, but when the AR shelf is instantiated, it tends to shift to an other direction instead of staying immobile. It means that the AR shelf is not superimposed anymore with the real shelf.
After some researches, I found it shifts because ARfoundation is not able to instantiate point clouds in the area anymore, which means the algorythm doesn't know where he is and try desesperatly to keep the AR shelf immobile.
It might be caused by: light, camera quality, environnement (like a person moving), the distance between the user and the AR object or even ARfoundation AI failure.

By default there is no error message or such kind (to my knowledge) when the ar objects shifts, because it's "normal" for the algorythm to adjust its position everytime. But when no AR point cloud are detected, it goes crazy.

So I'm wondering if there's any way to detect those shifts, or even better, prevent them. Any help is appreciated. I hope my request is clear and might help other people that have the same issue as me. Don't hesitate to ask me any questions, I'll be glad to answer them. Have a nice day!

Technical informations:

  • Unity version : 2020.3.27f1
  • ARFoundation + ARCore XR Plugin version : 4.1.9
  • Android version : 11
  • Device model: Samsung Galaxy Tab A7 SM-T500
  • Shelf measurement : h:1.85m, l: 0.80m, d: 0.60m
  • Average distance to the AR shelf: 0.3m~

Solution

  • Assuming that you are using AR Foundation's image recognition to recognize the QR code. Have you tried adding an anchor to your hologram?

    Ive successfully done image similar image recognition without the problems you mention.