在我的应用程序中,我想将 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/