How to Setup the Nav Mesh Agent

The XR Motions Rig prefab contains a NavMeshAgent child and a NavMeshPathfinding script that help you to quickly set up the navigation area in your scene by using Unity built-in AI features.

The following steps will help you to easily setup a navigatable scene in your project:

  1. Create the floor geometry where the player will be allowed to move. For instance, create a simple plane 3D object in Unity.

  2. Make the created geometry Navigation Static and bake a Nav Mesh as describer here.

  3. Delete the default scene camera and drag and drop the XR Motions Rig prefab, positioning it somewhere on the previously created floor geometry.

  4. Prepare your scene for running an XR device. For instance, for Oculus Quest or Oculus Rift, you should install the Oculus XR plugin from the Project Settings "XR Plug-in Management" section.

  5. Hit the play button and try navigating by using the controller joystick (in the example of Oculus devices).

For more information on customizing the nav mesh, see the Unity Navigation documentation. Here are some of the most important topics for achieving more complex scene navigation:

In this article
Not finding the help you need?