Version: 2019.4
LanguageEnglish
  • C#
Experimental: this API is experimental and might be changed or removed in the future.

NavMeshLocation

struct in UnityEngine.Experimental.AI

/

Implemented in:UnityEngine.AIModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A world position that is guaranteed to be on the surface of the NavMesh.

The NavMeshLocation stores the position on the NavMesh surface together with the PolygonId of the NavMesh node containing that position. Using NavMeshLocations with NavMeshQuery operations remove the need to project the desired world position onto the NavMesh at the beginning of each and every operation.

A NavMeshLocation can be invalid in two situations: 1. When it has been created empty, instead of being the result of a NavMeshQuery operation. 2. When the NavMesh has been removed or modified at the indicated position or in its close vicinity.

If a NavMeshLocation is made invalid by a NavMeshObstacle carving the NavMesh in its vicinity the NavMeshLocation returns to a valid state if the NavMeshObstacle is removed. This is because removing a NavMeshObstacle restores the NavMesh to its original form without regenerating it.

See Also: NavMeshQuery.MapLocation, NavMeshQuery.IsValid, PolygonId.

Properties

polygonUnique identifier for the node in the NavMesh to which the world position has been mapped.
positionA world position that sits precisely on the surface of the NavMesh or along its links.