Chapter 4. Interactions
In this chapter, we'll be looking at further interactions and dive into two of the most crucial elements of game development, namely, Collision Detection and Ray Casting.
To detect physical interactions between game objects, the most common method is to use a Collider component — an invisible net that surrounds an object's shape and is in charge of detecting collisions with other objects. The act of detecting and retrieving information from these collisions is known as collision detection.
Not only can we detect when two colliders interact, but we can also pre-empt a collision and perform many other useful tasks by utilizing a technique called Ray Casting, which draws a Ray — put simply, an invisible (non-rendered) vector line between two points in 3D space — which can also be used to detect an intersection with a game object's collider. Ray casting can also be used to retrieve lots of other useful information such as the length of the ray (therefore — distance), and...