ARKit floating planes

自古美人都是妖i 提交于 2019-12-06 16:34:08

I don't think you can prevent ARKit from generating overlapping planes as that part is pretty much a black box. However, two possibilities come to my mind to handle such a case.

1) Stop tracking after the first plane is found and insert an infinite plane to your scene. You can maybe use an SCNFloor for this purpose, or just a regular plane with enormous extents. This, of course, only is usable if you need a single plane in your scene.

2) Every once in a while (maybe inside delegate methods renderer(_: SCNSceneRenderer, didUpdate: SCNNode, for: ARAnchor) or renderer(_: SCNSceneRenderer, didAdd: SCNNode, for: ARAnchor)), manually check whether the planes in your scene are overlapping by projecting these planes on the xz-plane, make 2D collision tests and remove either one of them if the overlapping portion is higher than a certain threshold. You can also check if the distance between them in 3D is lower than a threshold to determine this.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!