Search Unity

How to limit ARPlaneManager to one plane?

Discussion in 'AR' started by J1wan, Jul 20, 2020.

  1. J1wan

    J1wan

    Joined:
    Jun 4, 2020
    Posts:
    15
    By default, ARPlaneManager will instantiate a plane GameObject everytime ARCore/ARKit detects a new plane. I want to limit plane detection to just one plane, and I know it's possible because other Unity apps on the Google Play Store only have one ARPlane instantiated during the plane detection phase. How do I limit ARPlaneManager to instantiating just one ARPlane GameObject?
     
  2. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,145
    You can set
    planeManager.requestedDetectionMode = PlaneDetectionMode.None;
    right after first plane has been detected.

    But I would not recommend doing this because the first detected plane is not always the most precise one. A much better solution would be not to display tracked planes at all and draw only a 'landing pad' - a place where your AR object can be potentially placed.
     
  3. J1wan

    J1wan

    Joined:
    Jun 4, 2020
    Posts:
    15
    Woahhh it's Kirill! Thanks for the response.

    Do you have any links/YouTube videos I can look at to learn how to make an AR landing pad? I couldn't find any while doing a Google search.
     
  4. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,145
    I don't have any links, but the idea is simple: make a
    ARRaycastManager.Raycast()
    from screen center and spawn your 'landing pad' on the intersection with the first ARPlane.