Hi,
I want to distinguish vertical and horizontal ARPlanes and disable vertical planes as soon as they are detected.
On my Android devices, the below code works fine, but not on my iPhone X. On the iPhone, vertical planes are still rendered and
args.plane.boundedPlane.Alignment == PlaneAlignment.Verticalis always false , it never evaluates to true, although a vertical plane was detected. I also tested in best lighting conditions, but this did not help.
(See the attached screenshot)
Is there any other way to achieve filtering out vertical planes?
void OnPlaneAdded(ARPlaneAddedEventArgs args)
{
bool isVertical = args.plane.boundedPlane.Alignment == PlaneAlignment.Vertical;
if (isVertical )
{
debug.text += "\n## Plane is vertical = " + isVertical + "; added, pos = " + args.plane.transform.position.y;
args.plane.GetComponent<Collider>().enabled = false;
args.plane.enabled = false;
args.plane.destroyOnRemoval = true;
args.plane.gameObject.SetActive(false);
}
}
I am on Unity 2018.2.0f2
ARFoundation 1.0.0 preview 20
ARKit XR Plugin 1.0.0 preview 17
ARCore XR Plugin 1.0.0 preview 23
Tested on an iPhone X, iOS 12.0.1
Hello Berenice2018,
ARFoundation 1.0.0 preview 22 will surface the ability to select your plane detection mode: horizontal, vertical, or both. It will be available soon. To use this mode, you will have to upgrade to the newly released Unity 2018.3: https://blogs.unity3d.com/2018/12/13/introducing-unity-2018-3/
The reason for this is explained in this forum post.
If your goal is to _distinguish_ between horizontal and vertical, you can just assume that "not horizontal" is vertical, e.g.
args.plane.boundedPlane.Alignment != PlaneAlignment.Horizontal
If your goal is to _disable_ vertical planes altogether, then you can update to ARFoundation 1.0.0-preview.22 as @MarioUnity suggests. There's an extra field on the ARPlaneManager to select the types of plane detection you'd like.
This was fixed properly in ARFoundation 2.0. The alignment property is now correct on ARKit.
Most helpful comment
The reason for this is explained in this forum post.
If your goal is to _distinguish_ between horizontal and vertical, you can just assume that "not horizontal" is vertical, e.g.
If your goal is to _disable_ vertical planes altogether, then you can update to ARFoundation
1.0.0-preview.22as @MarioUnity suggests. There's an extra field on theARPlaneManagerto select the types of plane detection you'd like.