I'm implementing an example app using ARKit + SceneKit. In order to do hittest on scenekit objects(nodes) in the scene, I used ARSCNView.hittest() and it worked well. However when I draw same scene with SCNRenderer(I'm writing also an offscreen renderer) and try to do hittest with SCNRenderer.hittest() but it doesn't return any results.
I assumed the range of input points should be only inside of GPU viewport which is SCNRenderer.currentViewport. But it doesn't work
Any idea how to do properly do hittest with SCNRenderer?
Thanks in advance
Hello,
Are you converting your view touch/click location to the renderer's viewport coordinate space?
let xScale = drawableSize.width/view.frame.width
let yScale = drawableSize.height/view.frame.height
let locationInViewport = CGPoint(x: locationInView.x*xScale, y: locationInView.y*yScale)
renderer.hitTest(locationInViewport, options: nil)