arfoundation-samples icon indicating copy to clipboard operation
arfoundation-samples copied to clipboard

Detecting if ARTrackedImage is off the screen?

Open YoungRichi opened this issue 6 years ago • 4 comments

Hello,

Can AR foundation check when an AR tracked image is off the screen?

From my understanding, the reference image is like a trigger. It gets triggered when AR camera recognizes an image target.

For example, I have an "ImageTrackingManager" script. It spawns a prefab when it "sees" a reference image from the library. Is it possible to check when a reference image is no longer in the camera?

I want to remove the prefab from world when the image target disappears. In order to do that, I'd have to somehow "unsee" a reference image? Maybe binding an event to "trackedImageChanged"?

Is that possible? Could that be a feature for future updates?

All suggestions are welcomed. Thank you.

YoungRichi avatar May 12 '20 08:05 YoungRichi

No, but the tracking state is somewhat correlated with visibility. See https://docs.unity3d.com/Packages/[email protected]/manual/tracked-image-manager.html#determining-when-an-image-is-visible for an explanation.

tdmowrer avatar May 12 '20 15:05 tdmowrer

Thank you for answering!

Do the tracking state changes to TrackingState.Limited when an object is blocking a tracked image? Lets say if i cover the tracked image with my palm.

Theoretically, I can then turn off the Prefab with setActive(false) if the tracked image is not visible. Is that correct?

YoungRichi avatar May 13 '20 06:05 YoungRichi

Do the tracking state changes to TrackingState.Limited when an object is blocking a tracked image? Lets say if i cover the tracked image with my palm.

I don't have anything to add to the docs I already linked, but I'll repeat them here. Please let me know they are not clear on this point:

There is no API to determine the visibility of an image. Generally, if the tracking state is Tracked, it will likely change to Limited when the image is not visible.

Theoretically, I can then turn off the Prefab with setActive(false) if the tracked image is not visible. Is that correct?

Yep.

tdmowrer avatar May 13 '20 19:05 tdmowrer

Thank you Tim!

YoungRichi avatar May 13 '20 23:05 YoungRichi