After reading up on the docs, I understand that to avoid collisions between two 3D objects, their &
operation has to come out to be zero. I have the same 3D object which I'm adding into my scene multiple times and acting a dynamic force on them via a vector. However, they continue to collide and change directions. I'd like them to not collide.
Hence, I've made the collisionBitMask
equal to 0 so once the &
operation happens and since the categoryBitMask
defaults to all bits being turned on, the result will equal to be zero so in other words the collision should NOT happen. But I continue to see the collision. Here's the code that I'm working with:
balloonNode.physicsBody = SCNPhysicsBody(type: .dynamic, shape: nil)
balloonNode.physicsBody?.isAffectedByGravity = false
balloonNode.physicsBody?.damping = 0.0
balloonNode.physicsBody?.collisionBitMask = 0
let xCord = 10 + Float(arc4random_uniform(20))
let yCord = 20 + Float(arc4random_uniform(40))
balloonNode.physicsBody?.applyForce(SCNVector3(xCord,yCord,0), asImpulse: false)
Since they are the same types of objects and the collisionBitMask is 0, shouldn't the collisions be avoided?