Search code examples
unity-game-enginearcore

How to determine a plane vertical or horizontal in ARcore?


As title, I want to determine a plane is vertical or horizontal in ARcore in run-time. How should I do this?


Solution

  • From ARCore Plane.Type docs:

    Plane.Type t = yourPlane.getType();
    
    if(t == Plane.Type.VERTICAL)
      // Vertical plane
    else if(t == Plane.Type.Plane.Type HORIZONTAL_DOWNWARD_FACING)
      // Ceiling, camera looking up at
    else if(t == Plane.Type.Plane.Type HORIZONTAL_DOWNWARD_FACING)
      // Floor, ground, camera looking down at