I am trying to make an app where users can measure distances on an ARSCNView. I have a scenario where there are 2 SCNNodes on top of each other. Node1 is always at the front because of its depth information. Node2 however is useful for measuring and getting accurate measurements. I would like to ignore touches on node1 and only get the location of touch on node2.
When I hide node1, the touches are properly recognized on node2. However, I still need node1 to be visible to the user.
I tried to change the renderingOrder and making sure that node2 is added to the rootNode after node1 is, but was of no success.
I also verified the hitTest array on tapping on a point, only the one hitTest on node1 is recognized and present in the array. So I'm not able to select a different hitTestResult either.
Further info: Node1 is a huge node which occupies a large space and node2 is formed from multiple child nodes.
You could probably do this using different Bitmasks (the
categoryBitmaskof theSCNNode) on which perform thehitTestResult.Or if you have
physicsBodiesinvolved on theSCNNodes, you can do a rayTest to its physicscategoryBitmasks. (scene.physicsWorld.rayTestWithSegment)