我正在尝试从以下内容中检索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 to Access Geometry并且正常工作
let hitResults: [SCNHitTestResult] = sceneView.hitTest(location, options: hitTestOptions)
if let hit = hitResults.first {
print(hit.node.geometry)
}
我已经尝试过这个hit.node.geometry?.name但是这会返回nil
答案 0 :(得分:0)
我刚刚解决了这个问题
node.name = "test"
if(hit.node.name == "test") { // Do Something }