Dungeon Architect
17.0.0
|
Do pathfinding calculations on the TiledNavMesh More...
Classes | |
struct | SegInterval |
Public Member Functions | |
NavMeshQuery (TiledNavMesh nav, int maxNodes) | |
Initializes a new instance of the NavMeshQuery class. More... | |
NavMeshQuery (TiledNavMesh nav, int maxNodes, Random rand) | |
Initializes a new instance of the NavMeshQuery class. More... | |
float | GetCost (Vector3 pa, Vector3 pb, Poly curPoly) |
The cost between two points may vary depending on the type of polygon. More... | |
Vector3 | FindRandomPointOnPoly (MeshTile tile, Poly poly, int polyRef) |
Finds a random point on a polygon. More... | |
void | FindRandomPointOnPoly (MeshTile tile, Poly poly, int polyRef, out Vector3 randomPt) |
Finds a random point on a polygon. More... | |
NavPoint | FindRandomPoint () |
Finds a random point somewhere in the navigation mesh. More... | |
void | FindRandomPoint (out NavPoint randomPoint) |
Finds a random point somewhere in the navigation mesh. More... | |
NavPoint | FindRandomPointAroundCircle (NavPoint center, float radius) |
Finds a random point in a NavMesh within a specified circle. More... | |
void | FindRandomPointAroundCircle (NavPoint center, float radius, out NavPoint randomPoint) |
Finds a random point in a NavMesh within a specified circle. More... | |
bool | FindPath (ref NavPoint startPt, ref NavPoint endPt, List< int > path) |
Find a path from the start polygon to the end polygon. -If the end polygon can't be reached, the last polygon will be nearest the end polygon -If the path array is too small, it will be filled as far as possible -start and end positions are used to calculate traversal costs More... | |
bool | FindStraightPath (Vector3 startPos, Vector3 endPos, int[] path, int pathSize, Vector3[] straightPath, int[] straightPathFlags, int[] straightPathRefs, ref int straightPathCount, int maxStraightPath, PathBuildFlags options) |
Add vertices and portals to a regular path computed from the method FindPath(). More... | |
bool | MoveAlongSurface (NavPoint startPoint, Vector3 endPos, ref Vector3 resultPos, List< int > visited) |
This method is optimized for small delta movement and a small number of polygons. If movement distance is too large, the result will form an incomplete path. More... | |
bool | InitSlicedFindPath (NavPoint startPoint, NavPoint endPoint) |
Initialize a sliced path, which is used mostly for crowd pathfinding. More... | |
bool | UpdateSlicedFindPath (int maxIter, ref int doneIters) |
Update the sliced path as agents move across the path. More... | |
bool | FinalizeSlicedFindPath (int[] path, ref int pathCount, int maxPath) |
Save the sliced path More... | |
bool | FinalizedSlicedPathPartial (int[] existing, int existingSize, int[] path, ref int pathCount, int maxPath) |
Save a partial path More... | |
bool | Raycast (NavPoint startPoint, Vector3 endPos, ref float t, ref Vector3 hitNormal, int[] path, ref int pathCount, int maxPath) |
bool | FindLocalNeighbourhood (NavPoint centerPoint, float radius, int[] resultRef, int[] resultParent, ref int resultCount, int maxResult) |
Store polygons that are within a certain range from the current polygon More... | |
bool | GetPolyWallSegments (int reference, Crowds.LocalBoundary.Segment[] segmentVerts, int[] segmentRefs, ref int segmentCount, int maxSegments) |
Collect all the edges from a polygon. More... | |
void | InsertInterval (SegInterval[] ints, ref int nints, int maxInts, int tmin, int tmax, int reference) |
Insert a segment into the array More... | |
bool | GetEdgeMidPoint (int from, Poly fromPoly, MeshTile fromTile, int to, Poly toPoly, MeshTile toTile, ref Vector3 mid) |
Get edge midpoint between two prolygons More... | |
bool | GetPortalPoints (int from, int to, ref Vector3 left, ref Vector3 right, ref PolygonType fromType, ref PolygonType toType) |
Find points on the left and right side. More... | |
bool | GetPortalPoints (int from, Poly fromPoly, MeshTile fromTile, int to, Poly toPoly, MeshTile toTile, ref Vector3 left, ref Vector3 right) |
Find points on the left and right side. More... | |
bool | ClosestPointOnPoly (int reference, Vector3 pos, ref Vector3 closest) |
Given a point on the polygon, find the closest point More... | |
bool | ClosestPointOnPoly (int reference, Vector3 pos, out Vector3 closest, out bool posOverPoly) |
Given a point on the polygon, find the closest point More... | |
bool | ClosestPointOnPolyBoundary (int reference, Vector3 pos, ref Vector3 closest) |
Given a point on a polygon, find the closest point which lies on the polygon boundary. More... | |
bool | AppendVertex (Vector3 pos, int flags, int reference, Vector3[] straightPath, int[] straightPathFlags, int[] straightPathRefs, ref int straightPathCount, int maxStraightPath) |
Add a vertex to the straight path. More... | |
bool | AppendPortals (int startIdx, int endIdx, Vector3 endPos, int[] path, Vector3[] straightPath, int[] straightPathFlags, int[] straightPathRefs, ref int straightPathCount, int maxStraightPath, PathBuildFlags options) |
Update the vertices on the straight path More... | |
bool | GetPolyHeight (int reference, Vector3 pos, ref float height) |
Return false if the provided position is outside the xz-bounds. More... | |
NavPoint | FindNearestPoly (Vector3 center, Vector3 extents) |
Find the nearest poly within a certain range. More... | |
void | FindNearestPoly (ref Vector3 center, ref Vector3 extents, out NavPoint nearestPt) |
Find the nearest poly within a certain range. More... | |
bool | QueryPolygons (ref Vector3 center, ref Vector3 extent, List< int > polys) |
Finds nearby polygons within a certain range. More... | |
bool | IsValidPolyRef (int reference) |
bool | IsInOpenList (Node node) |
bool | IsInClosedList (Node node) |
void | SetNodeFlagOpen (ref Node node) |
void | SetNodeFlagClosed (ref Node node) |
NodeFlags | RemoveNodeFlagClosed (Node node) |
Properties | |
TiledNavMesh | NavMesh [get] |
Do pathfinding calculations on the TiledNavMesh
Definition at line 24 of file NavMeshQuery.cs.
SharpNav.NavMeshQuery.NavMeshQuery | ( | TiledNavMesh | nav, |
int | maxNodes | ||
) |
Initializes a new instance of the NavMeshQuery class.
nav | The navigation mesh to query. |
maxNodes | The maximum number of nodes that can be queued in a query. |
Definition at line 41 of file NavMeshQuery.cs.
SharpNav.NavMeshQuery.NavMeshQuery | ( | TiledNavMesh | nav, |
int | maxNodes, | ||
Random | rand | ||
) |
Initializes a new instance of the NavMeshQuery class.
nav | The navigation mesh to query. |
maxNodes | The maximum number of nodes that can be queued in a query. |
rand | A random number generator for use in methods like NavMeshQuery.FindRandomPoint() |
Definition at line 52 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.AppendPortals | ( | int | startIdx, |
int | endIdx, | ||
Vector3 | endPos, | ||
int[] | path, | ||
Vector3[] | straightPath, | ||
int[] | straightPathFlags, | ||
int[] | straightPathRefs, | ||
ref int | straightPathCount, | ||
int | maxStraightPath, | ||
PathBuildFlags | options | ||
) |
Update the vertices on the straight path
startIdx | Original path's starting index |
endIdx | Original path's end index |
endPos | The end position |
path | The original path of polygon references |
straightPath | An array of points on the straight path |
straightPathFlags | An array of flags |
straightPathRefs | An array of polygon references |
straightPathCount | The number of points on the path |
maxStraightPath | The maximum length allowed for the straight path |
options | Options flag |
Definition at line 2154 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.AppendVertex | ( | Vector3 | pos, |
int | flags, | ||
int | reference, | ||
Vector3[] | straightPath, | ||
int[] | straightPathFlags, | ||
int[] | straightPathRefs, | ||
ref int | straightPathCount, | ||
int | maxStraightPath | ||
) |
Add a vertex to the straight path.
pos | |
flags | |
reference | |
straightPath | An array of points on the straight path |
straightPathFlags | An array of flags |
straightPathRefs | An array of polygon references |
straightPathCount | The number of points on the path |
maxStraightPath | The maximum length allowed for the straight path |
Definition at line 2106 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.ClosestPointOnPoly | ( | int | reference, |
Vector3 | pos, | ||
out Vector3 | closest, | ||
out bool | posOverPoly | ||
) |
Given a point on the polygon, find the closest point
reference | Polygon reference |
pos | Current position |
closest | Resulting closest position |
posOverPoly | Determines whether the position can be found on the polygon |
Definition at line 1976 of file NavMeshQuery.cs.
Given a point on the polygon, find the closest point
reference | Polygon reference |
pos | Given point |
closest | Resulting closest point |
Definition at line 1950 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.ClosestPointOnPolyBoundary | ( | int | reference, |
Vector3 | pos, | ||
ref Vector3 | closest | ||
) |
Given a point on a polygon, find the closest point which lies on the polygon boundary.
reference | Polygon reference |
pos | Current position |
closest | Resulting closest point |
Definition at line 2083 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.FinalizedSlicedPathPartial | ( | int[] | existing, |
int | existingSize, | ||
int[] | path, | ||
ref int | pathCount, | ||
int | maxPath | ||
) |
Save a partial path
existing | Existing path |
existingSize | Existing path's length |
path | New path |
pathCount | New path's length |
maxPath | Maximum path length allowed |
Definition at line 1238 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.FinalizeSlicedFindPath | ( | int[] | path, |
ref int | pathCount, | ||
int | maxPath | ||
) |
Save the sliced path
path | The path in terms of polygon references |
pathCount | The path length |
maxPath | The maximum path length allowed |
Definition at line 1176 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.FindLocalNeighbourhood | ( | NavPoint | centerPoint, |
float | radius, | ||
int[] | resultRef, | ||
int[] | resultParent, | ||
ref int | resultCount, | ||
int | maxResult | ||
) |
Store polygons that are within a certain range from the current polygon
centerPoint | Starting position |
radius | Range to search within |
resultRef | All the polygons within range |
resultParent | Polygon's parents |
resultCount | Number of polygons stored |
maxResult | Maximum number of polygons allowed |
Definition at line 1494 of file NavMeshQuery.cs.
void SharpNav.NavMeshQuery.FindNearestPoly | ( | ref Vector3 | center, |
ref Vector3 | extents, | ||
out NavPoint | nearestPt | ||
) |
Find the nearest poly within a certain range.
center | Center. |
extents | Extents. |
nearestPt | The neareast point. |
Definition at line 2270 of file NavMeshQuery.cs.
Find the nearest poly within a certain range.
center | Center. |
extents | Extents. |
Definition at line 2257 of file NavMeshQuery.cs.
Find a path from the start polygon to the end polygon. -If the end polygon can't be reached, the last polygon will be nearest the end polygon -If the path array is too small, it will be filled as far as possible -start and end positions are used to calculate traversal costs
startPt | The start point. |
endPt | The end point. |
path | The path of polygon references |
Definition at line 397 of file NavMeshQuery.cs.
NavPoint SharpNav.NavMeshQuery.FindRandomPoint | ( | ) |
Finds a random point somewhere in the navigation mesh.
Definition at line 132 of file NavMeshQuery.cs.
void SharpNav.NavMeshQuery.FindRandomPoint | ( | out NavPoint | randomPoint | ) |
Finds a random point somewhere in the navigation mesh.
randomPoint | Resulting random point. |
Definition at line 143 of file NavMeshQuery.cs.
Finds a random point in a NavMesh within a specified circle.
center | The center point. |
radius | The maximum distance away from the center that the random point can be. |
Definition at line 225 of file NavMeshQuery.cs.
void SharpNav.NavMeshQuery.FindRandomPointAroundCircle | ( | NavPoint | center, |
float | radius, | ||
out NavPoint | randomPoint | ||
) |
Finds a random point in a NavMesh within a specified circle.
center | The center point. |
radius | The maximum distance away from the center that the random point can be. |
randomPoint | A random point within the specified circle. |
Definition at line 238 of file NavMeshQuery.cs.
Finds a random point on a polygon.
tile | The current mesh tile |
poly | The current polygon |
polyRef | Polygon reference |
Definition at line 94 of file NavMeshQuery.cs.
void SharpNav.NavMeshQuery.FindRandomPointOnPoly | ( | MeshTile | tile, |
Poly | poly, | ||
int | polyRef, | ||
out Vector3 | randomPt | ||
) |
Finds a random point on a polygon.
tile | The current mesh tile |
poly | The current polygon |
polyRef | Polygon reference |
randomPt | Resulting random point |
Definition at line 108 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.FindStraightPath | ( | Vector3 | startPos, |
Vector3 | endPos, | ||
int[] | path, | ||
int | pathSize, | ||
Vector3[] | straightPath, | ||
int[] | straightPathFlags, | ||
int[] | straightPathRefs, | ||
ref int | straightPathCount, | ||
int | maxStraightPath, | ||
PathBuildFlags | options | ||
) |
Add vertices and portals to a regular path computed from the method FindPath().
startPos | Starting position |
endPos | Ending position |
path | Path of polygon references |
pathSize | Length of path |
straightPath | An array of points on the straight path |
straightPathFlags | An array of flags |
straightPathRefs | An array of polygon references |
straightPathCount | The number of points on the path |
maxStraightPath | The maximum length allowed for the straight path |
options | Options flag |
Definition at line 586 of file NavMeshQuery.cs.
The cost between two points may vary depending on the type of polygon.
pa | Point A |
pb | Point B |
curPoly | Current polygon |
Definition at line 74 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.GetEdgeMidPoint | ( | int | from, |
Poly | fromPoly, | ||
MeshTile | fromTile, | ||
int | to, | ||
Poly | toPoly, | ||
MeshTile | toTile, | ||
ref Vector3 | mid | ||
) |
Get edge midpoint between two prolygons
from | "From" polygon reference |
fromPoly | "From" polygon data |
fromTile | "From" mesh tile |
to | "To" polygon reference |
toPoly | "To" polygon data |
toTile | "To" mesh tile |
mid | Edge midpoint |
Definition at line 1818 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.GetPolyHeight | ( | int | reference, |
Vector3 | pos, | ||
ref float | height | ||
) |
Return false if the provided position is outside the xz-bounds.
reference | Polygon reference |
pos | Current position |
height | Resulting polygon height |
Definition at line 2210 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.GetPolyWallSegments | ( | int | reference, |
Crowds.LocalBoundary.Segment[] | segmentVerts, | ||
int[] | segmentRefs, | ||
ref int | segmentCount, | ||
int | maxSegments | ||
) |
Collect all the edges from a polygon.
reference | The polygon reference |
segmentVerts | Segment vertices |
segmentRefs | The polygon reference containing the segment |
segmentCount | The number of segments stored |
maxSegments | The maximum number of segments allowed |
Definition at line 1659 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.GetPortalPoints | ( | int | from, |
int | to, | ||
ref Vector3 | left, | ||
ref Vector3 | right, | ||
ref PolygonType | fromType, | ||
ref PolygonType | toType | ||
) |
Find points on the left and right side.
from | "From" polygon reference |
to | "To" polygon reference |
left | Point on the left side |
right | Point on the right side |
fromType | Polygon type of "From" polygon |
toType | Polygon type of "To" polygon |
Definition at line 1840 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.GetPortalPoints | ( | int | from, |
Poly | fromPoly, | ||
MeshTile | fromTile, | ||
int | to, | ||
Poly | toPoly, | ||
MeshTile | toTile, | ||
ref Vector3 | left, | ||
ref Vector3 | right | ||
) |
Find points on the left and right side.
from | "From" polygon reference |
fromPoly | "From" polygon data |
fromTile | "From" mesh tile |
to | "To" polygon reference |
toPoly | "To" polygon data |
toTile | "To" mesh tile |
left | Resulting point on the left side |
right | Resulting point on the right side |
Definition at line 1869 of file NavMeshQuery.cs.
Initialize a sliced path, which is used mostly for crowd pathfinding.
startPoint | The start point. |
endPoint | The end point. |
Definition at line 968 of file NavMeshQuery.cs.
void SharpNav.NavMeshQuery.InsertInterval | ( | SegInterval[] | ints, |
ref int | nints, | ||
int | maxInts, | ||
int | tmin, | ||
int | tmax, | ||
int | reference | ||
) |
Insert a segment into the array
ints | The array of segments |
nints | The number of segments |
maxInts | The maximium number of segments allowed |
tmin | Parameter t minimum |
tmax | Parameter t maximum |
reference | Polygon reference |
Definition at line 1779 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.MoveAlongSurface | ( | NavPoint | startPoint, |
Vector3 | endPos, | ||
ref Vector3 | resultPos, | ||
List< int > | visited | ||
) |
This method is optimized for small delta movement and a small number of polygons. If movement distance is too large, the result will form an incomplete path.
startPoint | The start point. |
endPos | End position |
resultPos | Intermediate point |
visited | Visited polygon references |
Definition at line 797 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.QueryPolygons | ( | ref Vector3 | center, |
ref Vector3 | extent, | ||
List< int > | polys | ||
) |
Finds nearby polygons within a certain range.
center | The starting point |
extent | The range to search within |
polys | A list of polygons |
Definition at line 2321 of file NavMeshQuery.cs.
bool SharpNav.NavMeshQuery.UpdateSlicedFindPath | ( | int | maxIter, |
ref int | doneIters | ||
) |
Update the sliced path as agents move across the path.
maxIter | Maximum iterations |
doneIters | Number of times iterated through |
Definition at line 1016 of file NavMeshQuery.cs.