Skip to main content

Navigation Mesh

Lightship Navigation Mesh provides a straightforward interface to control the movement of virtual objects by creating a grid of tiles on top of flat surfaces in the scene. This allows AR creatures to use the grid to move through space naturally, letting them walk around obstructions (such as tables or chairs) or jump on top of them.

Lightship NavMesh with DotyLightship NavMesh with Doty Jumping

Basic Usage

Prerequisites

For the best experience, enable and set up Lightship Meshing in your Unity scene. Planes and virtual objects with colliders can also be used to create a navigation mesh, but we recommend Lightship Meshing for best results.

Configuring LightshipNavMesh

LightshipNavMeshManager

Placing a LightshipNavMeshManager in the scene will generate a navigation mesh based on the available mesh. The LightshipNavMeshManager comes with settings and scripts that allow developers to fine-tune the navigation mesh. It contains settings for changing the balance of performance vs quality as well as the interval and how walkable space is detected.

Lightship NavMesh Manager Settings

For example, changing the tile size in LightshipNavMeshManager changes the layout of the grid. Smaller tiles will create a more detailed navigation mesh at the cost of performance. Larger tiles can lead to less "walkable" areas for improved performance. The optimal tile size depends on the specific requirements of your application.

Lightship NavMesh with Default TilesizeLightship NavMesh with Bigger Tilesize

Useful Scripts

LightshipNavMesh also comes with three default scripts that allow for a variety of tests and basic implementations: LightshipNavMeshRenderer, LightshipNavMeshAgent, and LightshipNavMeshAgentPathRenderer.


LightshipNavMeshRenderer lets developers render the navigation mesh to create custom visualizations. This is how the tiles were shown in the example above.

Lightship NavMesh Renderer

LightshipNavMeshAgent is a default agent implementation that interpolates an agent from its current location to a set destination in a straight line. It serves as a starting point for implementing complex agent movement. Depending on your type of game or experience, a different agent implementation may be necessary.

Lightship NavMesh Agent

LightshipNavMeshAgentPathRenderer provides a sample path renderer to show an agent's current path.

Lightship NavMesh Agent Path Renderer

The NavMesh Sample uses these scripts to have Captain Doty navigate a mesh with the rendering visuals turned on. For more information, see Sample Projects.

Lightship NavMesh with Doty and Renderers for Debugging

For a step by step guide on how to use Lightship Navigation Mesh, see How To Add Navigation Mesh.