hitTest boundingBox仅适用于SCNPlane

时间:2018-04-05 13:28:25

标签: 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知道这个位置是否有这种节点?

1 个答案:

答案 0 :(得分:0)

我找到了原因。

关闭调试模型,一切正常

//        sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]
相关问题