In this task, we detect if the ball passes through the hoop and we reward the player with scores. We will also create a world boundary and remove balls that are out of bounds.
The detection is done by placing a sensor between the hoop squares. The following figure shows how the sensor is placed:
For the boundary, it will be a long body that is placed at the bottom of the world, as shown in the following figure:
Let's add the sensor and handle the collision in the following steps: