The Chipmunk physics engine also includes a collision detection mechanism that can be used to check collisions between physics bodies. So, it is a prerequisite that both the objects need to have physics bodies attached for this to work.
Here, we will check the collision between the bottom of the basket and the ornament and gift. We won't include the candy stick for the example, but the process is the same.
We will also take a look at the collision between the gift, ornament, and edge loop.
If either the ornament or gift collides with either the edge loop or the bottom of the basket, we will delete the object colliding with them.
To get the collision to work, we have to set
MainScene as the delegate class. To use ...