Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ARFoundation Image Tracking - Remove event

Discussion in 'AR' started by Voronoi, May 22, 2019.

  1. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    584
    I am using the new Image tracking in ARFoundation:
    AR Foundation 2.1.0
    ARKit XR 2.1.0
    iOS 12.2
    iPhone 7 Plus

    Based on the AR Foundation Examples I am trying to make images appear only when the image marker is visible using the TrackedImageInfoManager.cs script. The image appears fine by subscribing to the
    trackedImagesChanged event, but I don't seem to ever get a 'removed' event argument and the
    trackedImage.trackingState seems to never be TrackingState.None as well.

    Am I misunderstanding how this works? Is the tracking state simply reporting that the device is active and has nothing to do with the marker visibility?

    The application is for an AR game where there will be 5 posters, each triggering a video. I want the video to stop playing when the person moves to another area and the marker is no longer visible. Right now, I am destroying the video using OnBecameInvisible, but this is not working quite right. The user may come back to the poster to trigger the video again and that is not working using this technique.

    I found that the trackedImage has this parameter that I set - trackedImage.destroyOnRemoval = true; That sounds like it would do what I want, but has no effect.
     
    dnnkeeper and seboverflow like this.
  2. Edisyo

    Edisyo

    Joined:
    Dec 11, 2017
    Posts:
    9