【发布时间】:2018-04-23 08:37:54
【问题描述】:
我不太确定如何真正使用此功能。我彻底搜索了互联网,但找不到正在使用此功能的示例的实例。在 SceneKit 中,我非常熟悉按节点名称搜索的函数。但这个函数令人困惑,因为它返回对布尔值的引用,该引用指定了一个数组。定义如下所示
func childNodes(passingTest predicate: (SCNNode, UnsafeMutablePointer<ObjCBool>) -> Bool) -> [SCNNode]
我到了这一点..这给了我所有我不知道为什么的节点..
let ballToDisappear = sceneView?.scene.rootNode.childNodes(passingTest: { (node, ballYesOrNo) -> Bool in
if (node.position.x < (maxVector?.x)! && node.position.x > (minVector?.x)!){
if (node.position.y < (maxVector?.y)! && node.position.y > (minVector?.y)!){
if (node.position.z < (maxVector?.z)! && node.position.z > (minVector?.z)!){
return ballYesOrNo.pointee.boolValue
}
}
}
return !ballYesOrNo.pointee.boolValue
}
)
任何帮助将不胜感激!谢谢!
【问题讨论】:
标签: ios swift boolean scenekit arkit