Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to improve AR plane floor detection on Android?

Discussion in 'AR' started by 2hTu2, Jun 8, 2022.

  1. 2hTu2


    Dec 20, 2015
    Good afternoon,

    I am currently working on a floor detection app for testing purposes. I have to say that I'm pretty impressed with the capabilities of what the AR foundation has to offer so far. The plane detection out of the box on Android however, is way too aggressive in my opinion. The first problem that I encountered was that it detected a lot of planes that were simply not there. Because I only need the floor plane I worked around the problem by only allowing the floor plane in the first place and then remove any other plane with the onPlaneAdded listener like so:

    Code (CSharp):
    2. void OnPlaneAdded(ARPlanesChangedEventArgs eventArgs)
    3.     {
    4.         if(hasPlane){
    5.             foreach (var plane in eventArgs.added){
    6.                 plane.gameObject.SetActive(false);
    7.             }
    8.         }
    10.         hasPlane = true;
    11.     }
    Now, this works pretty decent and already looks a lot cleaner. The remaining problem however is that the plane is still very aggressive is extending. For example: It still extends all the way into my kitchen counter as well as travel through walls to connect with a piece of plane on the other side.

    I was wondering if there is any way to improve upon this. I was thinking to restrain the plane on a locked y-axis, but it seems that that is simply not possible without inheriting the AR.subsystems package which again is not possible because all the classes are sealed.

    I uploaded a picture of the problem which you can find in the Attached files. I wish for the plane to be locked only to the ground floor somehow. Is there anyway I can write constraints for when the plane should extend?

    Any other tips regarding this issue are appreciated and thanks in advance!

    Edit1: I tried Niantic's LightSail with the hope that it has better plane detection, but it seems that they just build upon ARCore's plane detection algorithm.

    Attached Files:

    Last edited: Jun 8, 2022
  2. AaryanPatil


    Jul 13, 2021
    I dont have a solution but would like to ask - where did you add your above mentioned code