Is there any way to detect when the user swipe across SCNNode? I ve already tried UISwipeGestureReconizer but it didn't work for me. Any ideas?
Asked
Active
Viewed 150 times
1 Answers
0
Try adding a pan gesture recognizer
let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(panGesture))
panRecognizer?.delegate = self
view.addGestureRecognizer(panRecognizer!)
Depending if you want to know which direction you'll have to check out the translation of the view.
@objc func panGesture(sender: UIPanGestureRecognizer){
let translation = sender.translation(in: sender.view)
print(translation.x, translation.y)
}
}
Make sure you have you add the delegate - UIGestureRecognizerDelegate Hope that gives you a good start

HJDavies
- 138
- 7