The determinants of Sprite Kit collision and contact event processing are the relationship settings, created by you, of categoryBitMask
, collisionBitMask
and contactTestBitMask
for each of your interacting object types. By rationally setting these in service of your desired outcomes from contacts and collisions, you determine which types can collide and inform of contacts with others, and avoid undesired collision, contact and physics processing overhead.
For each type of 'entity' you can set all three:
categoryBitMask
: a category specific to this type of nodecollisionBitMask
: a collision differentiator, can be different from abovecontactTestBitMask
: a contact differentiator, can be different from both aboveThe general steps to implement collisions & contacts are: