Description
The NavMesh
property of the Scene
class provides access to the navigation mesh associated with the scene. A navigation mesh (NavMesh) is a data structure used in AI pathfinding to define walkable areas and obstacles within a scene. It is essential for enabling AI characters to navigate the environment efficiently.
Usage
To access the NavMesh
property, you need to have an instance of the Scene
class. Once you have the scene instance, you can retrieve the navigation mesh to perform operations such as pathfinding or modifying the navigation data.
Example
// Assuming 'scene' is an instance of Sandbox.Scene
Sandbox.Navigation.NavMesh navMesh = scene.NavMesh;
// Use the navMesh for pathfinding or other operations
if (navMesh != null)
{
// Example: Check if a point is on the nav mesh
Vector3 point = new Vector3(10, 0, 10);
bool isOnNavMesh = navMesh.IsPointOnNavMesh(point);
if (isOnNavMesh)
{
// Perform pathfinding or other operations
}
}