Part of SCNNode is not intractable

Hello,


I have faced with the following issue:


Part of SCNNode is not interactable e.g. it seems like it is shifted a bit but visually it is located in a different place. I do perform geometry offset using geometry shader modifier by shifting all verticies along x axis. Originally SCNNode had position at x:0, y:0, z:0 point and 8 by 10 units dimensions. Then I apply shader modifier and offset all verticies for 4 units right, along x axis. Four units right is a half of the geometrie's width and that exact propotion of geometry is not interactable.


I tried to change bounding box, offset texture coordinates and some other crazy things - nothing is working. My questions is: how to tell SceneKit that my node has been shifted using shader modifier and be able to receive touch events correctly?


Please, I really need help, cant figure out how SceneKit handles user interactions when programmtically geometry is modified.

Accepted Reply

As it turned out, a SCNNode may not be fully intractable because its bounding volume does not match the geometry. In order to solve this issue I had to turn on debug option for SCNView that allows to inspect bounding volumes. After fixing the offset of bounding volume I was able to interact with previously uninteractable parts of SCNNode. Also note that bounding volume allows just roughly determine if node was interacted - in order to more preciously determine texture coord or vertex you need to use SCNHitTestResult instance and perform one of the corresponding operations (either use textureCoordinates method or localCoordinates property).

Replies

As it turned out, a SCNNode may not be fully intractable because its bounding volume does not match the geometry. In order to solve this issue I had to turn on debug option for SCNView that allows to inspect bounding volumes. After fixing the offset of bounding volume I was able to interact with previously uninteractable parts of SCNNode. Also note that bounding volume allows just roughly determine if node was interacted - in order to more preciously determine texture coord or vertex you need to use SCNHitTestResult instance and perform one of the corresponding operations (either use textureCoordinates method or localCoordinates property).