Search Unity

Question Confirmation of marker image recognition and release status for AR image tracking work?

Discussion in 'AR' started by zooltagi, Mar 8, 2023.

  1. zooltagi

    zooltagi

    Joined:
    Feb 16, 2017
    Posts:
    1
    hi!
    Help me
    I am making an AR game using image tracking technique in unity3d.
    After loading the desired 3D modeling object into the marker image, I plan to shoot and kill this object.
    I want to give a signal to find the marker image again and recognize it when the distance from the marker image is away or the marker image is out of the camera.
    When the image tracking is released away from the marker image, the object floats alone. At this time, I want to turn the object off the screen.
    In image tracking, can I receive the signal of the situation where the marker image is recognized and the situation where it is not recognized?
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,062
    You have a couple options.

    MonoBehaviour.OnBecameInvisible will trigger once the GameObject is no longer in the camera frustum, which can be useful for detecting the moment that the camera is no longer pointed at the image: https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnBecameInvisible.html

    Image trackingState may go to Limited if the platform loses its ability to track the image: https://docs.unity3d.com/Packages/c...l/features/image-tracking.html#tracking-state. However, the platform will continue to try to track the image even when it is offscreen, so this state change may not fire the moment the image goes offscreen.