【问题标题】:hitTest boundingBoxOnly not work for SCNPlanehitTest boundingBoxOnly 不适用于 SCNPlane
【发布时间】:2018-09-15 08:23:03
【问题描述】:

在我的应用中,我想将 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 知道这个位置是否有这种节点?

【问题讨论】:

    标签: ios swift arkit


    【解决方案1】:

    我找到了原因。

    关闭调试模型,一切正常

    //        sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]
    

    【讨论】:

      猜你喜欢
      • 2020-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-08
      • 2018-01-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多