如何访问命中测试的索引?

How can I access the indices of a hit test?

我正在尝试通过命中测试将不同的对象添加到场景中,但我目前只能添加一个对象。我想访问命中测试结果中的第二个、第三个和第四个索引,以便通过触摸添加这些对象。

我试过通过 .indices 访问,但它与 UITouch 不兼容。

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

    if let touch = touches.first {

        let touchLocation = touch.location(in: sceneView)

        let results = sceneView.hitTest(touchLocation, types: .featurePoint)

        if let hitResult = results.first {
            let cubeScene = SCNScene(named: "art.scnassets/cube.scn")!

            if let cubeNode = cubeScene.rootNode.childNode(withName: "cube", recursively: true) {


                sceneView.scene.rootNode.addChildNode(cubeNode)

            }
        }
    }
}

我该怎么办?我想过创建一个 SCNScene,将其作为数组传递,然后从场景中加载所有模型。

正如 Samual 所建议的...示例

var hitTestOptions = [SCNHitTestOption: Any]()

    @objc func handleTap(recognizer: UITapGestureRecognizer)
        {
             let location: CGPoint = recognizer.location(in: gameScene)
             let hitResults: [SCNHitTestResult] = gameScene.hitTest(location, options: hitTestOptions)
             for vHit in hitResults
             {
              if(vHit.node.name?.prefix(5) == "Panel")
              {
               gameControl.selectPanel(vPanel: vHit.node.name!)
               return
              }
             }
            }