Having Issues with Plane Detection

  • Issue category: Plane Detection
  • Device type & OS version: Android
  • Host machine & OS version: Windows
  • Issue Environment : On Device
  • ARDK version: 1.0.1
  • Unity version: 2020.3.22f1

Description of the issue: I’m trying to follow this tutorial about detecting planes. I’ve implemented a class that creates an AR Session and detecting planes by following the tutorial. It seems working about finding planes. But I feel like there is something missing about merging them. When I try to detect the top of my bed with ARPlaneManager, it seems like there is only one plane detected. When I try with my custom class, it detects the same plane again and again which casues the PlanePrefab to be generated multiple times on top of itself. I tried to check the ARPlaneManager to see differences and implemented OnAnchorsUpdated and OnAnchorsRemoved accordingly as well like this:

	private void OnAnchorsRemoved(AnchorsArgs args) {
		foreach (var anchor in args.Anchors) {
			if (anchor.AnchorType == AnchorType.Plane) {
				Destroy(PlaneLookup[anchor.Identifier]);
				PlaneLookup.Remove(anchor.Identifier);
			}
		}
	}

	private void OnAnchorsUpdated(AnchorsArgs args) {
		foreach (IARPlaneAnchor anchor in args.Anchors) {
			if (PlaneLookup.TryGetValue(anchor.Identifier, out GameObject plane)) {
				plane.transform.position = anchor.Transform.ToPosition();
				plane.transform.rotation = anchor.Transform.ToRotation();
				plane.transform.localScale = anchor.Extent;
			}
		}
	}

It doesn’t seem like it changed anything. Here are pictures from two different scenes with the same view, my bed. First is with my custom class and second one is with ARPlaneManager. I hope the difference is visible. (Putting link to second image since I can’t post 2 images)

Another issue or question I have is, is this the correct way to let my session detect both horizontal and vertical planes?
config.PlaneDetection = PlaneDetection.Horizontal | PlaneDetection.Vertical;
From the pictures it’s also can be seen that the walls aren’t being detected quite well. Is this something caused by my test case and the texture of my wall? Or am I doing something wrong?

Thanks for all the answers/suggestions in advance!

Hi, sorry that you’re experiencing trouble with detecting planes. Please send over the error log if you have it available.

If the AR Plane Manager is enabled you should be able to remove the planes. To stop rendering existing planes, deactivate their GameObjects. There’s more information here on disabling planes: AR plane manager.

In reference to your question about vertical and horizontal planes, config.PlaneDetection = PlaneDetection.Horizontal | PlaneDetection.Vertical; is the correct way to detect both planes.
There’s more information on meshing in our documentation. I hope this helps.

1 Like

Do I have to have ARPlaneManager on my scene? I thought by implementing the events myself on my custom manager I could replicate the same logic so I can have more control over it?

Hi, here is more information on ARPlaneManager. Yes, if you want to customize it and have more control. I hope this helps. Please reach out if you need more help.