1

Can one physics body have 2 different collision bit masks?

I have this code:

         bo.physicsBody?.collisionBitMask = noneCategory

But I'd like "bo" to also collide with "bumperCategory". So, I imagine it could look something like this:

        bo.physicsBody?.collisionBitMask = noneCategory && bumperCategory

That doesn't work. Is there anyway to do something similar to this?

Confused
  • 6,048
  • 6
  • 34
  • 75
Alan Scarpa
  • 3,352
  • 4
  • 26
  • 48

1 Answers1

3

You were close, but you need to bitwise OR instead of logical AND the two categories:

bo.physicsBody?.collisionBitMask = noneCategory | bumperCategory
Jsdodgers
  • 5,253
  • 2
  • 20
  • 36