# Plane Detection - table extended across the whole room

**URL:** <https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953>\
**Category:** I'm Stuck\
**Created:** [May 10, 2022, 4:30pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953 "2022-05-10T16:30:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Julian\_Anderson](https://community.nianticspatial.com/u/Julian_Anderson)\
**Post date:** [May 10, 2022, 4:30pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/1 "2022-05-10T16:30:44Z")

</div>

- **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?

 ![desk_plane](https://us1.discourse-cdn.com/niantic/original/1X/0517c97ca46b8242227cd50fd9a2fba38011c567.jpeg)  
 ![midair2](https://us1.discourse-cdn.com/niantic/original/1X/e538417d9ec11c2c54d67caf9e9d6cd8dab9bb6f.jpeg)  
 ![midair1](https://us1.discourse-cdn.com/niantic/original/1X/3d6eb70d5c376808e8cb4703d43ecd50b6b7fcbb.jpeg)

---

<div class="post-metadata">

**Author:** ![Gilberto](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@Gilberto](https://community.nianticspatial.com/u/Gilberto)\
**Post date:** [May 12, 2022, 8:48pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/2 "2022-05-12T20:48:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gilberto](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@Gilberto](https://community.nianticspatial.com/u/Gilberto)\
**Post date:** [May 23, 2022, 10:39pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/3 "2022-05-23T22:39:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Darryl\_Hughes](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@Darryl\_Hughes](https://community.nianticspatial.com/u/Darryl_Hughes)\
**Post date:** [May 26, 2022, 9:37pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/4 "2022-05-26T21:37:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Julian\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Julian\_Anderson](https://community.nianticspatial.com/u/Julian_Anderson)\
**Post date:** [May 27, 2022, 11:44am UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/5 "2022-05-27T11:44:07Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Darryl\_Hughes](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@Darryl\_Hughes](https://community.nianticspatial.com/u/Darryl_Hughes)\
**Post date:** [May 29, 2022, 11:13pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/6 "2022-05-29T23:13:02Z")

</div>

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

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

[Here](https://lightship.dev/docs/ardk/api-documentation/interface_Niantic_ARDK_AR_IARFrame.html#methods) 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.

---

<div class="post-metadata">

**Author:** ![Gilberto](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@Gilberto](https://community.nianticspatial.com/u/Gilberto)\
**Post date:** [May 31, 2022, 5:20pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/7 "2022-05-31T17:20:10Z")

</div>

@Julian_Anderson and @Darryl_Hughes ,  
Taking a look here:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Julian\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Julian\_Anderson](https://community.nianticspatial.com/u/Julian_Anderson)\
**Post date:** [May 31, 2022, 5:22pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/8 "2022-05-31T17:22:59Z")

</div>

@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…

---

<div class="post-metadata">

**Author:** ![Darryl\_Hughes](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@Darryl\_Hughes](https://community.nianticspatial.com/u/Darryl_Hughes)\
**Post date:** [June 1, 2022, 12:14am UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/9 "2022-06-01T00:14:38Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Maverick\_Niantic](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@Maverick\_Niantic](https://community.nianticspatial.com/u/Maverick_Niantic)\
**Post date:** [March 5, 2026, 11:50pm UTC](https://community.nianticspatial.com/t/plane-detection-table-extended-across-the-whole-room/1953/10 "2026-03-05T23:50:15Z")

</div>

Age
