Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

Hide GameObjects under a hidden or transparent detected plane in ARFoundation

Discussion in 'Handheld AR' started by soorya696, May 25, 2019.

  1. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    13
    Hi,
    I want to hide the game objects if the object goes under the detected plane while translating it up and down. Does anybody know how to achieve this?
     
  2. OlivierHoel

    OlivierHoel

    Joined:
    Dec 15, 2017
    Posts:
    3
    The simplest way is to instantiate a plane with a specific material that only renders to depth buffer (and not color). Also ensure that this renders before any opaque object.
     
  3. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    13
    Thanks for the response.
     
  4. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    13
    Finally, I got a solution. Just add a material with Occlusion shader from "shader->XR/VR->Occlusion" to the plane prefab.
    That's all. The shader will do the magic.
    Maybe helpful for someone.