Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignoring an object in hittest

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.

enter image description here

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.

like image 640
superman Avatar asked May 07 '17 13:05

superman


1 Answers

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
like image 170
mnuages Avatar answered Oct 22 '22 11:10

mnuages