RealityKit on iOS: New anchor entity takes ages to show up

I'm implementing an AR app with Image Tracking capabilities. I noticed that it takes very long for the entities I want to overlay on a detected image to show up in the video feed.

When debugging using debugOptions.insert(.showAnchorOrigins), I realized that the image is actually detected very quickly, the anchor origins show up almost immediately. And I can also see that my code reacts with adding new anchors for my ModelEntities there.

However, it takes ages for these ModelEntities to actually show up. Only if I move the camera a lot, they will appear after a while.

What might be the reason for this behaviour?

I also noticed that for the first image target, a huge amount of anchors are being created. They start from the image and go all up towards the user. This does not happen with subsequent (other) image targets.

The first issue (entities taking a long time to show up) could be related to asset loading times. I recommend taking a closer look (e.g. using Instruments) to narrow down the cause of the delay. If you are displaying large USDZ models, potential solutions can include reducing their size, or caching them before you run the AR experience.

With regard to image anchors, only one ARImageAnchor should be added for each image. You can verify this by looking at the image anchor's referenceObject property. However, it is possible that you receive update callbacks for already existing image anchors. If the value for maximumNumberOfTrackedImages is set to 1, then you will receive updates only for the first image that was detected in the scene. Subsequent images will only be detected, but not tracked.

RealityKit on iOS: New anchor entity takes ages to show up
 
 
Q