Add/Remove ReferenceObject after ARSession is started in visionOS

Hi, in visionOS2, I wonder if there is a method to add/remove referenceObjects of ObjectTrackingProvider after ARSession started without stop it.

Now I must stop it and run it again. The current tracking is stopped.

Thanks.

Answered by Vision Pro Engineer in 816593022

So should I load all RefereneceObjects at the begining?

No. For performance reasons it makes sense to only load the reference objects that you know can be detected in the user's current room. So restarting the session with a new set of reference objects when entering a new room makes a lot of sense.

I would encourage you to test how disruptive this is to the end user experience - usually restarting the session should be a fast operation so in the best case users would not notice a short gap in hand tracking. If it is noticeable for users then you can split your providers to run on two ARKitSession instances - one for hands & world tracking and a second session just for object tracking.

Sorry, in visionOS 2.0 there is no way to add/remove ReferenceObjects on a running ObjectTrackingProvider.

Most apps have a fixed set of reference objects that they want to detect, so they don't run into this limitation. I would encourage you to file a feedback request via the feedback assistant if you know of a use case where you frequently need to change the set of reference objects being detected.

My usecase is user has a big scene including some areas(like a house with different room, or a room has different tables), each area has some objects need to tracked. If user walk from one area to another I want to switch to the objects that should be tracked in this area. So should I load all RefereneceObjects at the begining?

I still use hand tracking and world tracking for other functions. If I stop ARSession to update ReferenceObjects for ObjectTrackingProvider, other tracking providers will also restart, this may affect user experience.

And is there a method to fix this problem? Thanks

@Vision Pro Engineer

Accepted Answer

So should I load all RefereneceObjects at the begining?

No. For performance reasons it makes sense to only load the reference objects that you know can be detected in the user's current room. So restarting the session with a new set of reference objects when entering a new room makes a lot of sense.

I would encourage you to test how disruptive this is to the end user experience - usually restarting the session should be a fast operation so in the best case users would not notice a short gap in hand tracking. If it is noticeable for users then you can split your providers to run on two ARKitSession instances - one for hands & world tracking and a second session just for object tracking.

Add/Remove ReferenceObject after ARSession is started in visionOS
 
 
Q