Chapter 16: Physics Collisions and Health System
Since games try to simulate real-world behaviors, one important aspect to simulate is physics, which dictates how Objects move and how they collide with each other, such as players colliding with walls, bullets, or enemies. Physics can be difficult to control due to the myriad of reactions that can happen after a collision. So, in this chapter, we will learn how to configure this to obtain semi-accurate Physics, which will generate the desired arcade movement feeling but get collisions working – after all, sometimes, real life is not as interesting as video games.
In this chapter, we will cover the following collision concepts:
- Configuring Physics
- Detecting collisions
- Moving with Physics
First, we will learn how to properly configure Physics, a step that's needed for the collisions between Objects to be detected by our scripts, using new events we are also going to learn about. All of this is needed...