Hi, I seem to be having an issue with Image tracking in ARFoundation, and specifically
removing of trackables.
eventArgs.removed never gets called, even when a tracked image is out of sight.
Last event received is always limited for an ARTrackedImage but never 'none'.
Thanks.
Same problem here.
Unity 2019.2.13f1
ARCore XR Plugin 3.0.1
ARFoundation 3.0.1
ARKit XR Plugin 3.0.1
Also checked the "Max Number Of Moving Targets" which solved this same problem in issue #261 with no effect.
void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)
{
foreach (ARTrackedImage trackedImage in eventArgs.added)
{
// Give the initial image a reasonable default scale
trackedImage.transform.localScale = new Vector3(0.01f, 1f, 0.01f);
UpdateInfo(trackedImage);
}
foreach (ARTrackedImage trackedImage in eventArgs.updated)
{
UpdateInfo(trackedImage);
}
foreach (ARTrackedImage trackedImage in eventArgs.removed)
{
Debug.Log("Removed");
}
}
The Removed is never loged.
Are you observing this with ARKit as well as ARCore?
When using ARCore this is expected behavior. We confirmed with Google today that the ARCore API assumes that augmented images are static in the environment so once they are recognized successfully they will always appear in the list of anchors until the session is reset. This means that AR Foundation will never report that a tracked images is removed on ARCore-enabled devices nor will a tracked image's tracking state be reported as None.
@mdurand42 Thank you for your response. Yes I tested it with ARKit and it is working fine. I will try to reset the session every time a new image is tracked.
@mdurand42 Thank you for your response. Yes I tested it with ARKit and it is working fine. I will try to reset the session every time a new image is tracked.
No, you should not reset the session in this case. I was merely telling you when ARCore would remove the augmented image from its list of trackables. But resetting the session is not the solution to the issue.
I just tried this with Unity2019.4 and can confirm with ARKit .removed is never called... When will this be fixed?
I'm building an ARKit app that really needs to be able to get the removed event. Is there an older version of Unity where it works? Looking for a fix or workaround ASAP.
I also just tried upgrading ARFoundation to the 4.0.2 release and this event still doesn't ever come through...
The "removed" event is rarely triggered these days, probably because ARCore and ARKit can now track moving images. You are probably looking for the tracking state, which will change from Tracking to Limited if the image cannot be seen or is otherwise unable to be, well, tracked.
There is a more detailed explanation in the docs.
Thank you so much! I'm now hiding on tracked Limited. All is great!
Most helpful comment
Same problem here.
Unity 2019.2.13f1
ARCore XR Plugin 3.0.1
ARFoundation 3.0.1
ARKit XR Plugin 3.0.1
Also checked the "Max Number Of Moving Targets" which solved this same problem in issue #261 with no effect.
The Removed is never loged.