我正在尝试从以下内容中检索 string=Gate。
<SCNHitTestResult: 0x1c4016dc0 <0.167996,0.067400,-0.095000> | geometryIndex=0 node=<SCNNode: 0x1c43e1100 'test' pos(0.000000 0.000000 -0.100000) scale(0.010000 0.010000 0.010000) | geometry=<SCNText: 0x1c43e0e00 | 3 elements | string=Gate extrusionDepth=1.000> | no child> bone=(null)>
MyCode 访问几何并且工作正常,如下
let hitResults: [SCNHitTestResult] = sceneView.hitTest(location, options: hitTestOptions)
if let hit = hitResults.first {
print(hit.node.geometry)
}
I already have tried this hit.node.geometry?.name but this returns nil
最佳答案
我刚刚解决了这个问题
node.name = "test"
if(hit.node.name == "test") { // Do Something }
关于ios - ARKit 中访问节点名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48414093/