Plane Detection - table extended across the whole room

  • Issue category: Plane detection
  • Device type & OS version: iPhone XS on iOS 15.4
  • Host machine & OS version: Mac on Monterey
  • Issue Environment : Unity Remote / Unity Mock / On Device / Dev Portal
  • Xcode version: 13.3.1
  • ARDK version: 1.3.1
  • Unity version: 2020.3.33

When I scan the floor in my room and then turn towards the table, it finds a new plane at the height of the table. So far so good. But then I turn away from the table towards the rest of the room and the table plane seems to extend across the whole room, which causes the plane hit tests to register in mid-air. In fact, even without the table, sometimes the features seem to be floating in mid air. The hit test returns “ExistingPlane” as the hit type.

On Android things seem to be much more stable and I don’t see such issues, even though the Android device is quite old (Pixel 3).

I am using the default ARPlaneManager (vertical and horizontal planes) and hit testing against everything. I tried hit testing against FeaturePoints only and it’s better but still features are sometimes floating in space.

Some screenshots attached. Any ideas what’s going on?



Hi Julian,

First I need to verify what the problem is. From my point of view there could be 2 separate things happening here, one is the rendering of the planes and the other is the “hit detection” of the planes… like does it bother you that the lines are being drawn farther than the table (kind of unclear in the screenshots if they get corrected) or that the objects are appearing(detecting a hit) mid air, or both?

Then the other thing is: When you say “hit testing against everything,” is it correct to assume you are using the “ARHitTester” script to do so? And if you’re not, or if you changed anything in its code, could you show me how you are testing for these hits? I need to see the HitTest settings and values you are putting there, basically.

Hey @Julian_Anderson
Just checking in to see if this is still something you are having trouble with.

I am having this same issue on my pixel 4 using the example scene PlaneAnchors. @Julian_Anderson Did you ever manage a solution?

Hi Gilberto, Darryl,

Sorry, this slipped off my radar and I forgot to reply.

The real issue for me is the hit tests registering in mid-air, not the rendering of the planes. The planes seem to correct themselves somewhat after walking around, but sometimes they are still in mid-air.

I am using the same code from the ARHitTester in my own class:

public bool RaycastAgainstWorld(Vector2 screenPos, ref Vector3 worldPos) {    
        var currentFrame = session.CurrentFrame;
        if (currentFrame == null) return false;

        var results = currentFrame.HitTest(Camera.pixelWidth, Camera.pixelHeight, screenPos, HitTestType);

        if(results.Count <= 0)
            return false;

        worldPos = results[0].WorldTransform.ToPosition();
        return true;
    }

Darryl, I’ve moved to raycasting against Features only and the problem is somewhat mitigated but still not solved.

I’ve made significant improvements by getting the last object from results

worldPos = results[results.Count -1].WorldTransform.ToPosition();

Here the documentation says that the returned results are sorted nearest to farthest.

I currently have it raycasting against everything, but I feel that some subset of this would get better results.

@Julian_Anderson and @Darryl_Hughes ,
Taking a look here:

var results = currentFrame.HitTest(Camera.pixelWidth, Camera.pixelHeight, screenPos, HitTestType);

I am guessing this is the case but just to be sure, can you check if HitTestType 's value is ExistingPlane? And if so, try changing it to ExistingPlaneUsingExtent and let me know if that helped.

@Gilberto The HitTestType was ExistingPlaneUsingExtent. Now I am using FeaturePoint as mentioned previously.

@Darryl_Hughes That makes a lot of sense! But I wonder if that will introduce new issues, such as planes and features beyond the surfaces for some reason…

@Julian_Anderson It does. I often have my character sunk into the ground up to their ankles. But I suspect that’s because I’m also using all the estimated geometry in my HitTestType (EstimatedArbitraryPlane, EstimatedHorizontalPlane, and EstimatedVerticalPlane). It’s good enough for my purposes now, and will circle back to this issue after I make some more gameplay-related progress. Hopefully I’ll post an update in about a week.