Chapter 5. Interactions
In this chapter, we'll be looking at further interactions and dive into three of the most crucial elements of game development, namely:
Collision Detection—detecting interactions between objects by detecting when their colliders collide with one another
Trigger Collision Detection—detecting when colliders set to trigger mode have other colliders within their boundary
Ray Casting—drawing a line (or vector) in the 3D world from one point to another, in order to detect potential collisions without two colliders colliding or intersecting
In order to learn about these three topics, we will introduce an outpost model to our island, and learn how to write code for interactions by making the outpost's door open when the player character walks towards it. We will look at how to achieve this with each of the listed techniques, before choosing the most appropriate one for use in our game. First let's look at the relevant import settings for our outpost, and then add the outpost...