Create and interact with Unitys navigation system.

Project Setup

Load the UnityLink package:

Create a new project called Navigation in your home directory:

Create two asset directories that we will use to keep the project organized:

Create a new scene and save it to the Scenes directory:

Create multiple Unity meshes and save them to the Meshes directory:

Specify the colors of the scene objects:

Create multiple materials and save them to the Materials directory:

Environment Setup

Create a static platform the scene and assign its material:

Move the main camera:

Change the background color of the camera:

Create an empty game object to act as the parent for the walls we will create:

Create the walls:

Set the material of all the walls and change them to be static:

Door Setup

Create the sliding door:

Add a Rigidbody component to the door so it can move when forces are applied to it:

Add a ConstantForce component to the door that we can use to open and close the door:

Obstacle Setup

Create an empty game object to act as the parent for the obstacles we will create:

Specify the meshs and positions of the obstacles:

Create the obstacles as children of the obstacles parent object:

Add a Rigidbody component to each of the obstacles:

Set the Convex property of the obstacle MeshColliders to be true:

Set the obstacle materials:

Player Setup

Create a Unity capsule primitive to act as the player:

Add a Camera component to the player:

Navigation Setup

Add a NavMeshObstacle component to the sliding door:

Add a NavMeshObstacle component to each obstacle:

Add a NavMeshAgent component to the Player game object:

Bake the NavMesh:


Define a function for creating an interactable dynamic graphic:

Switch the Unity editor to play mode:

Create the controls:

Click anywhere on the graphic to have to player navigate to that position:

Click the Open/Close Door button to open or close the sliding door:

Press the Stop/Start button to pause the players movement.

Press the Switch View button to alternate between the overhead camera and the player camera:

Exit play mode: