我正在尝试从下面检索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)
}
我已经尝试过这个hit.node.geometry?.name,但是返回nil
最佳答案
我已经解决了这个问题
node.name = "test"
if(hit.node.name == "test") { // Do Something }
关于ios - ARKit中的访问节点名称,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48414093/