[This is preliminary documentation and is subject to change.]
Assembly: cai-nav (in cai-nav.dll) Version: 0.4.0.0 (0.4.0.0)
|C#||Visual Basic||Visual C++|
The start point.
The end point.
The list of polygon references that represent the path corridor.
The index within the path buffer of the polygon that contains the start point.
The length of the path within the path buffer. (endPolyIndex - startPolyIndex)
Points describing the straight path. [(point) * straightPathCount].
Flags describing each point. [(flags) * striaghtPathCount] (Optional)
The reference of the polygon that is being entered at the point position. [(polyRef) * straightPathCount] (Optional)
The number of points in the straight path.
Return ValueThe NavStatus flags for the query.
This method peforms what is often called 'string pulling'.
If the provided result buffers are too small for the entire result, they will be filled as far as possible from the start point toward the end point.
The start point is clamped to the first polygon in the path, and the end point is clamped to the last. So the start and end points should be within or very near the first and last polygons respectively. The pathStart and pathCount parameters can be adjusted to restrict the usable portion of the the path to meet this requirement. (See the example below.)
The returned polygon references represent the polygon that is entered at the associated path point. The reference associated with the end point will always be zero.
Example use case for adjusting the straight path during locomotion:
Senario: The path consists of polygons A, B, C, D, with the start point in A and the end point in D.
The first call to the method will return straight waypoints for the entire path:
query.GetStraightPath(startPoint, endPoint , path , 0, 4 // pathStart, pathCount , straigthPath, null, null , out straightCount);
If the agent moves into polygon B and needs to recaclulate its straight path for some reason, it can call the method as follows using the original path buffer:
query.GetStraightPath(startPoint, endPoint , path , 1, 3 // pathStart, pathCount <- Note the changes here. , straigthPath, null, null , out straightCount);