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

NavMeshQuery.GetPortalPoints

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

Declaration

public bool GetPortalPoints(Experimental.AI.PolygonId polygon, Experimental.AI.PolygonId neighbourPolygon, out Vector3 left, out Vector3 right);

Parameters

polygon First NavMesh node.
neighbourPolygon Second NavMesh node.
left One of the world points for the resulting separation edge which must be passed through when traversing between the two specified nodes. This point is the left side of the edge when traversing from the first node to the second.
right One of the world points for the resulting separation edge which must be passed through when traversing between the two specified nodes. This point is the right side of the edge when traversing from the first node to the second.

Returns

bool True if a connection exists between the two NavMesh nodes. False if no connection exists between the two NavMesh nodes.

Description

Obtains the end points of the line segment common to two adjacent NavMesh nodes.

For two polygons that are part of a NavMesh surface, this method returns the edge where both polygons meet. If the two polygons are in different NavMesh tiles the connected edges can be of different length or have different start and end positions from each other. If this happens the resulting separation edge is the overlapping part of the edges, which may be shorter than either of the individual edges.

When one node is a link and the other is a polygon, the returned points are placed where the link intersects the polygon.

The resulting positions are expressed in world space and can be transformed into a NavMesh's local space by the use of NavMeshQuery.PolygonWorldToLocalMatrix.

Additional resources: NavMeshQuery.GetEdgesAndNeighbors.