In the previous part of this chapter, you prepared the
CrashWithAsteroid methods. However, you cannot detect situations when the rocket reaches the planet or is crashed. In this part, you will implement a mechanism of detecting collisions between the rocket and other objects in the game world.
There are many approaches for solving the problem of detecting collisions between objects. One of the common approach is based on an idea of bounding sphere (see the following figure). This approach simplifies the process of finding collisions between elements, because each of them is represented as a sphere. Therefore, you can simply compare distance between centers of two spheres and their radiuses. This approach ...