SCNPhysicsBody collisionBitMask does not work correctly if body is added to SCNNode after node is already attached to the scene

Originator:nicklockwood81
Number:rdar://19096514 Date Originated:30/11/2014
Status:Open Resolved:
Product:iOS SDK Product Version:8.1
Classification:Bug Reproducible:Always
 
Summary:
Adding an SCNPhysicsBody to an SCNNode when the node is already attached to the rootNode of a scene seems to work as expected.

However, setting the collisionBitMask and/or categoryBitMask either has no effect, or behaves unexpectedly.

Setting the collisionBitMask works fine if the SCNPhysicsBody was added to the node before the node was added to the scene.

Steps to Reproduce:
See attached project - reproduction steps are included in the comments in ViewController.swift

1. Create a pair SCNNodes with SCNBox geometry and stack them vertically in a scene
2. Add them to the scene.rootNode
3. Add a static physics body to the lower one and a dynamic physics body to the upper one
4. set the collisionBitMask of both physics bodies to 0
5. Run the app

Expected Results:
The dynamic box should fall through the static box because their collisionBitMasks indicate that they should not collide with anything, including each other

Actual Results:
The boxes collide with each other

Version:
iOS SDK 8.1, Xcode 6.1

Notes:


Configuration:
iPhone 6 and iOS simulator

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!