Tap / Select Node in SceneKit (Swift)

淺唱寂寞╮ 提交于 2019-12-03 06:48:16

You can hit test the scene view (for example from the location of a tap gesture recognizer), which will give you a list of hit test results. From each result you can get the node (and other information):

let location: CGPoint = // for example from a tap gesture recognizer
let hits = self.sceneView.hitTest(location, options: nil)
if let tappedNode = hits?.first?.node {
    // do something with the tapped node ...
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!