hitTest boundingBoxOnly 不适用于 SCNPlane

hitTest boundingBoxOnly not work for SCNPlane

在我的应用程序中,我想向 rootNode 添加一个 SCNPlane。

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

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

我想防止 SCN 平面重叠。

所以我尝试了这个:

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

但是我发现它只在节点的边缘有效

请帮帮我。

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

找到原因了。

关闭调试模式,一切正常

//        sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]