Skip to main content

NavMesh

Singleton class to access the baked NavMesh.

Members

Properties

NameDescription
NavMesh.avoidancePredictionTimeDescribes how far in the future the agents predict collisions for avoidance.

Static Properties

NameDescription
NavMesh.AllAreasArea mask constant that includes all NavMesh areas.
NavMesh.onPreUpdateSet a function to be called before the NavMesh is updated during the frame update execution.
NavMesh.pathfindingIterationsPerFrameThe maximum number of nodes processed for each frame during the asynchronous pathfinding process.

Static Methods

NameDescription
NavMesh.AddLink(link)Adds a link to the NavMesh. The link is described by the NavMeshLinkData struct. Returns an instance for the added link.
NavMesh.AddLink(link, position, rotation)Adds a link to the NavMesh. The link is described by the NavMeshLinkData struct. Returns an instance for the added link.
NavMesh.AddNavMeshData(navMeshData)Adds the specified NavMeshData to the game.
NavMesh.AddNavMeshData(navMeshData, position, rotation)Adds the specified NavMeshData to the game.
NavMesh.CalculatePath(sourcePosition, targetPosition, areaMask)Calculate a path between two points and store the resulting path.
NavMesh.CalculatePath(sourcePosition, targetPosition, filter)Calculate a path between two points and store the resulting path.
NavMesh.CalculateTriangulation()Calculates triangulation of the current navmesh.
NavMesh.FindClosestEdge(sourcePosition, areaMask)Locate the closest NavMesh edge from a point on the NavMesh.
NavMesh.FindClosestEdge(sourcePosition, filter)ocate the closest NavMesh edge from a point on the NavMesh, subject to the constraints of the filter argument.
NavMesh.GetAreaCost(areaIndex)Gets the cost for path finding over geometry of the area type.
NavMesh.GetAreaFromName(areaName)Returns the area index for a named NavMesh area type.
NavMesh.Raycast(sourcePosition, targetPosition, areaMask)Trace a line between two points on the NavMesh.
NavMesh.Raycast(sourcePosition, targetPosition, filter)Traces a line between two positions on the NavMesh, subject to the constraints defined by the filter argument. The line is terminated on outer edges or a non-passable area.
NavMesh.RemoveAllNavMeshData()Removes all NavMesh surfaces and links from the game.
NavMesh.RemoveLink(handle)Removes a link from the NavMesh.
NavMesh.RemoveNavMeshData(handle)Removes the specified NavMeshDataInstance from the game, making it unavailable for agents and queries.
NavMesh.SamplePosition(sourcePosition, maxDistance, areaMask)Finds the nearest point based on the NavMesh within a specified range.
NavMesh.SamplePosition(sourcePosition, maxDistance, filter)Samples the position nearest the sourcePosition on any NavMesh built for the agent type specified by the filter. Consider only positions on areas defined in the NavMeshQueryFilter.areaMask. A maximum search radius is set by maxDistance. The information of any found position is returned in the hit argument.
NavMesh.SetAreaCost(areaIndex, cost)Sets the cost for finding path over geometry of the area type on all agents.

Extra Detail

Use the NavMesh class to perform spatial queries such as pathfinding and walkability tests. This class also lets you set the pathfinding cost for specific area types, and tweak the global behavior of pathfinding and avoidance.