sprite-kit SKNode Collision Difference between contacts and collisions

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

In Sprite-Kit, there is the concept of collisions which refers to the SK physics engine handling how physics objects interact when they collide i.e. which ones bounce off which other ones.

It also has the concept of contacts, which is the mechanism by which your program gets informed when 2 physics objects intersect.

Objects may collide but not generate contacts, generate contacts without colliding, or collide and generate a contact (or do neither and not interact at all)

Collisions can also be one-sided i.e. object A can collide (bounce off) object B, whilst object B carries on as though nothing had happened. If you want 2 object to bounce off each other, they must both be told to collide with the other.

Contacts however are not one-sided; if you want to know when object A touched (contacted) object B, it is enough to set up contact detection on object A with regards to object B. You do not have to set up contact detection on object B for object A.



Got any sprite-kit Question?