I have an image target set, and a 3D object set to appear when the camera recognizes the image target. But when i move the image target off screen, the 3D object doesn't disappear. Sometimes it gets stuck at the corner of the screen where the image target went off screen, sometimes if I move the image target too fast it gets stuck where the image used to be. See screenshot of stuck object.
How do I get the object to only show up when the image target is visible?
Thanks!
Attachment | Size |
---|---|
![]() | 100.34 KB |
If you look at the OnTrackingLost() method, it tells you just how it's hiding your augmentations. It takes all the render components (Mesh Renderer, Sprite Renderer etc.) for the objects that are children of the ImageTarget, puts them into an array, and disables them via a loop. Take a look at the objects that won't disappear and make sure they each have a render component and that they are children of the ImageTarget.
My guess is the times where it does "disappear" it's actually still rendering but just off screen.
Another thing you can check is that when the object moves off screen, the "Trackable " + mTrackableBehaviour.TrackableName + " lost" debug text is printed to the console. If it is, you at least know that OnTrackingLost() is being called.