Ignoring an object in hittest

hittest, scenekit, swift

Solution

when performing the hit test you can use the SCNHitTestOptionCategoryBitMask option to restrict the set of nodes that are tested.

Nodes have a categoryBitMask property and only the ones for which the following condition is satisfied will participate in the hit test:

node.categoryBitMask & hitTestOptionCategoryBitMask != 0

Problem

Is it possible to ignore an object in SceneKit's hitTest so that when the hitTest ray is sent, it goes through an object? I still want to see both objects, i just want the ray to ignore another. Here the top image shows how it works now, and the bottom is what i'd like to have. I think that it would be possible by putting the sphere to another view, but i don't think that i could see the object then.

Original source