[This is preliminary documentation and is subject to change.]

Finds the polygon path from the start to the end polygon.

Namespace: org.critterai.nav
Assembly: cai-nav (in cai-nav.dll) Version: 0.4.0.0 (0.4.0.0)

Syntax

         
 C#  Visual Basic  Visual C++ 
public NavStatus FindPath(
	ref NavmeshPoint start,
	ref NavmeshPoint end,
	Vector3 extents,
	NavmeshQueryFilter filter,
	uint[] resultPath,
	out int pathCount
)
Public Function FindPath ( _
	ByRef start As NavmeshPoint, _
	ByRef end As NavmeshPoint, _
	extents As Vector3, _
	filter As NavmeshQueryFilter, _
	resultPath As UInteger(), _
	<OutAttribute> ByRef pathCount As Integer _
) As NavStatus
public:
NavStatus FindPath(
	NavmeshPoint% start, 
	NavmeshPoint% end, 
	Vector3 extents, 
	NavmeshQueryFilter^ filter, 
	array<unsigned int>^ resultPath, 
	[OutAttribute] int% pathCount
)

Parameters

start
NavmeshPoint%
A point within the start polygon. (In) (Out if the polygon reference is zero.)
end
NavmeshPoint%
A point within the end polygon. (In) (Out if the polygon reference is zero.)
extents
Vector3
The search extents to use if the start or end point polygon reference is zero.
filter
NavmeshQueryFilter
The filter to apply to the query.
resultPath
array<UInt32>[]()[][]
An ordered list of polygon references in the path. (Start to end.) (Out) [(polyRef) * pathCount]
pathCount
Int32%
The number of polygons in the path.

Return Value

The NavStatus flags for the query.

Remarks

This method is useful if the polygon reference of either the start or end point is not known. If both points have a polygon reference of zero, then this method is equivalent to the following:

  1. Using GetNearestPoint(UInt32, Vector3, Vector3%) with the start point to get the start polygon.
  2. Using GetNearestPoint(UInt32, Vector3, Vector3%) with the end point to get the end polygon.
  3. Calling the normal find path using the two new start and end points.

A point search will only be performed for points with a polygon reference of zero. If a point search is required, the point and its polygon reference parameter become output parameters and the point will be snapped to the navigation mesh.

This method may return a partial result, even if there is a failure. If there is no failure, it will at least perform the required point searches. If the point searches succeed, then the find path operation will be performed.

Checking the return results:

  • If the pathCount is greater than zero, then the path and all required point searches succeeded.
  • If the overall operation failed, but a point with an input polygon reference of zero has an output polygon reference that is non-zero, then that point's search succeeded.

For the path results:

If the end polygon cannot be reached, then the last polygon is the nearest one found to the end polygon.

If the path buffer is to small to hold the result, it will be filled as far as possible from the start polygon toward the end polygon.

The start and end points are used to calculate traversal costs. (y-values matter.)

See Also