Как определить, был ли затронут SCNBox в сценическом наборе?
Как определить, был ли затронут SCNBox в сценическом наборе? Я создаю приложение VR
0 ответов
Вы можете использовать это:
let tapGR = UITapGestureRecognizer(target: self, action: #selector(tapGesture(sender:)))
sceneView.addGestureRecognizer(tapGR)
@objc func tapGesture(sender: UITapGestureRecognizer) {
let location: CGPoint = (sender.location(in: self.sceneView))
let hits = self.sceneView.hitTest(location, options: nil)
if let tappedNode : SCNNode = hits.first?.node {
tappedNode.position.y += 0.5
print(tappedNode)
}
}