Search Unity

Question OnMatchLoss(QueryResult queryResult) is not working

Discussion in 'Unity MARS' started by Ciobi98, Jul 29, 2020.

  1. Ciobi98

    Ciobi98

    Joined:
    Jul 29, 2020
    Posts:
    18
    I want to make an object to disappear when one of my Image Marker is matching and when other Image Marker is recognized that object to be visible again (is a button on my canvas). I've tried to that using those functions : OnMatchAcquire and OnMatchLoss , but only first one is called and when i put my camera on the second Image Target first Image Target is still recognized. Here being the second problem. How to reset those conditions when one Image Target is recognized other to be not.

    Thanks for help!
     
  2. unity_andrewm

    unity_andrewm

    Unity Technologies

    Joined:
    Jun 25, 2015
    Posts:
    73
    Hi
    The big issue you are running up against is that an image marker provider is not necessarily going to consider an image marker that is out of view to be 'lost'. Many of them will continue to just assume they are located in space where they were previously.

    I would recommend creating a script that examines if particular objects (your image markers) are active and within the camera frustum. If the amount of objects is 1, show the button, otherwise hide it.
     
  3. Ciobi98

    Ciobi98

    Joined:
    Jul 29, 2020
    Posts:
    18
    I understand ! Any idea what i can use to do that or any advice ? :)
    Thansk for help !
     
  4. unity_andrewm

    unity_andrewm

    Unity Technologies

    Joined:
    Jun 25, 2015
    Posts:
    73
    Thread details some methods for checking if things are in view:
    https://forum.unity.com/threads/is-target-in-view-frustum.86136/

    Using worldToViewportPoint is probably the most straightforward, though you might get loss cases when things are near the edge depending on the size of the image marker.

    Using the frustum planes is most accurately but a little more complex scripting-wise
     
  5. Ciobi98

    Ciobi98

    Joined:
    Jul 29, 2020
    Posts:
    18
    Well, i did it with frustum planes , thanks !!!
    Any idea when unity mars will have a simulation in real time for image markers (like that one in Vuforia )?
    Because is very stressful to build every time to verify! :))
     
  6. Spaekz

    Spaekz

    Joined:
    Jun 17, 2020
    Posts:
    12
    I don't know if this is what you are looking for this but by using Mars Panel with simulation view open, you can instantiate an synthetic Image Marker ,set an image to it in your simulation and it will avoid to build every time.
     
    Last edited: Aug 3, 2020