ios - hitTestboundingBoxOnly 不适用于 SCNPlane

标签 ios swift arkit

在我的应用程序中,我想将 SCNPlane 添加到 rootNode。

这是一个带有边框的简单节点。 (只是一个带有透明主体的盒子)

layer.frame = CGRect(x: 0, y: 0, width: WIDTH, height: WIDTH*heigh/width)
    layer.backgroundColor =  UIColor(displayP3Red: 0, green: 150, blue: 255, alpha: 0.2).cgColor
    layer.borderWidth = 10
    layer.borderColor = UIColor.red.cgColor

let scene = SCNPlane(width: width, height: heigh)
    scene.firstMaterial?.isDoubleSided = false
    scene.firstMaterial?.diffuse.contents = layer
    geometry    = scene

我想防止 SCNPlanes 重叠。

所以我尝试了这个:

let results = sceneView.hitTest(point, options: [.boundingBoxOnly : true])
guard (result.node as? ViewNode) == nil else { return }

但我发现它只适用于节点的边缘。

请帮助我。

如何使用hitTest知道这个位置是否有这种节点?

最佳答案

我找到了原因。

关闭调试模型,一切正常

//        sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]

关于ios - hitTestboundingBoxOnly 不适用于 SCNPlane,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49673603/

相关文章:

javascript - <embed> 或 <object> 标记视频播放错误处理程序 - JavaScript

快速滚动到只有空白部分的表格底部

ios - 如何在 SceneKit 的 sceneView 中正确地为阴影添加定向光?

ios - Swift:以编程方式导航到 ViewController 并传递数据

ios - 隐藏 iPad 上运行的 iPhone 应用程序的状态栏

ios - 在 iOS 中实现长时间运行的后台任务

swift - tvOS 检查当前聚焦的 ui 元素是否是 CollectionViewCell

ios - 获取位置后无法更新标签

ios - ARKit 电平测量

ios - 如何更改 ARSCNDebugOptions FeaturePoints 的外观?