Opening the outpost
In this section, we will look at the three differing approaches for interacting with the door, in order to give you an overview of the techniques that will become useful in many other game development situations:
In the first approach, we'll use collision detection—a crucial concept to get to grips with as you begin to work on games in Unity.
In the second approach, we'll implement a simple ray cast forward from the player, another important skill to learn—that means we can detect interactions without colliders actually physically colliding.
Finally, we'll implement the most efficient approach for this scenario—using a separate Trigger collider to call the animation on the door.
This means that you will have tried three differing approaches to the problem, and will have code to refer to once you begin your own development.
Approach 1—Collision detection
To begin writing the script that will play the door-opening animation and thereby grant access to the outpost, we need to...