ahaghdan
ahaghdan

Reputation: 198

SceneKit HitTest Small Object in Swift

I am trying to move a cylinder using the pan gesture.

Got this working however the hittest does not work well with small objects and my big fingers.

Is there anyway I can expand the objects bounding box so it is bigger then the cylinder making it easier to be moved/hittested?

I am passing in the SCNHitTestBoundingBoxOnlyKey option so if I could expand the bounding box maybe it will work better.

Upvotes: 0

Views: 487

Answers (1)

ahaghdan
ahaghdan

Reputation: 198

I think I found a solution!

One should be able to add a bigger cylinder and make it a child note to the original cylinder. Then make it hidden, and pass the option SCNHitTestIgnoreHiddenNodesKey=NO when doing the hitTest. This way a small cylinder/object can be moved with pan gesture allthough it is smaller then a touch/finger point.

Upvotes: 2

Related Questions