The asset object that contains a Quantum navigation mesh. The object loads an additional data file during the Loaded(IResourceManager, Native.Allocator). This is because of size limitations when loading the data with Unity serialization. More...
Inherits Quantum.IBuiltInAssetObject.
Public Member Functions  
void  ClampToGrid (ref FPVector2 position) 
Clamps the position to be on the grid. More...  
void  ClampToGrid (ref FPVector3 position) 
Clamps the position to be on the grid. More...  
Boolean  Contains (FPVector3 position, NavMeshRegionMask regionMask, bool inclusive=false) 
Checks if the position is on a navmesh triangle. Does only check the 2D coordinates. More...  
bool  FindClosestTriangle (FPVector3 sourcePosition, FP radius, NavMeshRegionMask regionMask, out Int32 triangle, out FPVector3 closestPosition, MailboxSet8 mailbox=null) 
Finds the closest navmesh triangle at the position plus radius. Works in 2D and 3D. Caveat: The result is only a heuristic and not 100% accurate due to simplified calculations to reduce precision issues. For example: in 3D the input position is projected down instead of finding the correct closest position. The search can be performance heavy so carefully choose the radius. More...  
bool  FindClosestTriangle (FrameBase frame, FPVector3 sourcePosition, FP radius, NavMeshRegionMask regionMask, out Int32 triangle, out FPVector3 closestPosition) 
Finds the closest navmesh triangle at the position plus radius. Works in 2D and 3D. This method sets the mailboxing optimization internally which requires the frame object. Otherwise it's identical to NavMesh.FindClosestTriangle(FPVector3, FP, NavMeshRegionMask, out int, out FPVector3, MailboxSet8). Caveat: The result is only a heuristic and not 100% accurate due to simplified calculations to reduce precision issues. For example: in 3D the input position is projected down instead of finding the correct closest position. The search can be performance heavy so carefully choose the radius. More...  
bool  FindClosestTriangle (FrameThreadSafe frame, FPVector3 sourcePosition, FP radius, NavMeshRegionMask regionMask, out Int32 triangle, out FPVector3 closestPosition) 
Finds the closest navmesh triangle at the position plus radius. Works in 2D and 3D. This method sets the mailboxing optimization internally which requires the frame object. Otherwise it's identical to NavMesh.FindClosestTriangle(FPVector3, FP, NavMeshRegionMask, out int, out FPVector3, MailboxSet8). Caveat: The result is only a heuristic and not 100% accurate due to simplified calculations to reduce precision issues. For example: in 3D the input position is projected down instead of finding the correct closest position. The search can be performance heavy so carefully choose the radius. More...  
Int32  FindClosestTriangleFast (FPVector3 position, NavMeshRegionMask regionMask) 
Searches the closest triangle to the input position by using the fallback triangle saved for each grid cell. Result is quite inaccurate. More...  
bool  FindRandomPointOnNavmesh (FPVector3 position, FP radius, RNGSession *rngSession, NavMeshRegionMask regionMask, out FPVector3 result) 
Tries to find a random position on the navmesh using the input position and radius. This can fail when there is no navmesh in range. More...  
bool  FindRandomPointOnTriangle (Int32 triangle, RNGSession *rngSession, out FPVector3 result) 
Generates a random point on the triangle. More...  
Int32  FindTriangle2D (FPVector3 position, NavMeshRegionMask regionMask, bool inclusive=false) 
Finds the triangle at position (X,Z). This will not work in 3D as overlapping triangles may occur. Always use FindClosestTriangle() in 3D. More...  
bool  IsBorderActive (int borderIndex, NavMeshRegionMask regionMask) 
Test if the region of the border at index is enabled. More...  
override void  Loaded (IResourceManager assets, Native.Allocator allocator) 
Checks the DataAsset to load the additional data and runs Serialize(ByteStream, bool) to deserialize the navmesh data. More...  
unsafe FPVector2  MovePositionIntoNavmesh (FPVector2 position, FPVector2 newPosition, FP correction, NavMeshRegionMask regionMask) 
This performs a correction of the agent movement against the navmesh borders much like solving physics contacts. This works only in 2D for now. Used internally if NavMeshAgentConfig.ClampAgentToNavmesh is set. More...  
unsafe FPVector2  MovePositionIntoNavmesh (FrameBase frame, FPVector2 position, FPVector2 newPosition, FP correction, NavMeshRegionMask regionMask) 
This performs a correction of the agent movement against the navmesh borders much like solving physics contacts. This works only in 2D for now. Used internally if NavMeshAgentConfig.ClampAgentToNavmesh is set. More...  
unsafe FPVector2  MovePositionIntoNavmesh (FrameThreadSafe frame, FPVector2 position, FPVector2 newPosition, FP correction, NavMeshRegionMask regionMask) 
This performs a correction of the agent movement against the navmesh borders much like solving physics contacts. This works only in 2D for now. Used internally if NavMeshAgentConfig.ClampAgentToNavmesh is set. More...  
void  Serialize (ByteStream stream, Boolean write) 
Serializes internal data structures (Triangles, TrianglesGrid, Vertices, BorderGrid, TrianglesCenterGrid, Regions, Borders) from the byte stream. Called during . More...  
Static Public Member Functions  
static Int64  GetHeightAtTriangleRaw (FPVector3 p, FPVector3 normal, FPVector3 v0) 
Returns the ycomponent of the triangle at point p. Does not check if the point is actually on the XZdimensions of the triangle. Projects the exact XZ position and does not find the closet position inside the triangle. More...  
Public Attributes  
Int32  BorderCount => Borders?.Length ?? 0 
Gets the number of borders. More...  
NavMeshBorderNode[]  BorderGrid 
Per grid cell data structure that holds all indices to borders inside this cell. More...  
NavMeshBorder[]  Borders 
Navmesh borders. More...  
AssetRefBinaryData  DataAsset 
Asset that contains the actual binary navmesh data. More...  
Int32  GridNodeSize 
The number of units one grid cell has in both dimensions. Minimum 2. Must be an even number. Derived from the map values during baking. More...  
Int32  GridSizeX 
The navmesh triangles are partitioned by simple 2D grid. This is the number of all cells on the xaxis. Derived from the map values during baking. More...  
Int32  GridSizeY 
The number of all grid cells on the yaxis. Derived from the map values during baking. More...  
FP  MinAgentRadius 
The smallest agent radius that the navmesh was created for (to pass visually nicely around the corners). More...  
String  Name 
Name of the navmesh. Access the navmesh by name through Map.NavMeshes. More...  
NavMeshTriangle[]  Triangles 
Navmesh triangles. More...  
NavMeshTriangleCenterGridNode[]  TrianglesCenterGrid 
Per grid cell data structure that holds one (multiple if regions are used) triangle that is somewhat closest to the grid center as a fallback triangle lookup. More...  
NavMeshTriangleNode[]  TrianglesGrid 
Per grid cell data structure that holds all indices to triangles inside this cell. More...  
NavMeshVertex[]  Vertices 
Navmesh vertices referenced by triangles. More...  
FPVector2  WorldOffset 
The center of the map is the origin. The world offset represents the lower left corner and is copied from Quantum.Map during the navmesh baking. More...  
The asset object that contains a Quantum navigation mesh. The object loads an additional data file during the Loaded(IResourceManager, Native.Allocator). This is because of size limitations when loading the data with Unity serialization.

inline 
Checks the DataAsset to load the additional data and runs Serialize(ByteStream, bool) to deserialize the navmesh data.
assets  The resource manager to access other assets 
allocator  The allocator to allocate additional memory for this asset 

inline 
Clamps the position to be on the grid.
position  World position 

inline 
Clamps the position to be on the grid.
position  World position 

inlinestatic 
Returns the ycomponent of the triangle at point p. Does not check if the point is actually on the XZdimensions of the triangle. Projects the exact XZ position and does not find the closet position inside the triangle.
p  Point to project to triangle 
normal  Triangle normal 
v0  Point in triangle 

inline 
Finds the closest navmesh triangle at the position plus radius. Works in 2D and 3D. This method sets the mailboxing optimization internally which requires the frame object. Otherwise it's identical to NavMesh.FindClosestTriangle(FPVector3, FP, NavMeshRegionMask, out int, out FPVector3, MailboxSet8). Caveat: The result is only a heuristic and not 100% accurate due to simplified calculations to reduce precision issues. For example: in 3D the input position is projected down instead of finding the correct closest position. The search can be performance heavy so carefully choose the radius.
frame  Frame object to locate mailbox memory 
sourcePosition  Position to start looking 
radius  Search radius around starting position. Use FP.0 to only search at the exact input position. 
regionMask  Region mask 
triangle  The resulting triangle id 
closestPosition  The corrected source position on the navmesh 

inline 
Finds the closest navmesh triangle at the position plus radius. Works in 2D and 3D. This method sets the mailboxing optimization internally which requires the frame object. Otherwise it's identical to NavMesh.FindClosestTriangle(FPVector3, FP, NavMeshRegionMask, out int, out FPVector3, MailboxSet8). Caveat: The result is only a heuristic and not 100% accurate due to simplified calculations to reduce precision issues. For example: in 3D the input position is projected down instead of finding the correct closest position. The search can be performance heavy so carefully choose the radius.
frame  Frame object to locate mailbox memory 
sourcePosition  Position to start looking 
radius  Search radius around starting position. Use FP.0 to only search at the exact input position. 
regionMask  Region mask 
triangle  The resulting triangle id 
closestPosition  The corrected source position on the navmesh 

inline 
Finds the closest navmesh triangle at the position plus radius. Works in 2D and 3D. Caveat: The result is only a heuristic and not 100% accurate due to simplified calculations to reduce precision issues. For example: in 3D the input position is projected down instead of finding the correct closest position. The search can be performance heavy so carefully choose the radius.
sourcePosition  Position to start looking 
radius  Search radius around starting position. Use FP.0 to only search at the exact input position (don't use for 3D). 
regionMask  Region mask 
triangle  The resulting triangle id 
closestPosition  The corrected source position on the navmesh 
mailbox  Optionally add a mailbox data structure to optimize the performance of search by filtering out already checked triangles. 

inline 
Finds the triangle at position (X,Z). This will not work in 3D as overlapping triangles may occur. Always use FindClosestTriangle() in 3D.
position  Sample position 
regionMask  Region mask 
inclusive  Use inclusive true when you want include the border and the vertices of the triangle 

inline 
Searches the closest triangle to the input position by using the fallback triangle saved for each grid cell. Result is quite inaccurate.
position  Input position 
regionMask  Triangle regions are checked if they are active 

inline 
Generates a random point on the triangle.
triangle  Triangle index. Use FindTriangle() to find the triangle at a position. 
rngSession  Random number generator usually f>RNG. 
result  Random position on the triangle or Zero if the triangle does not exists. 

inline 
Tries to find a random position on the navmesh using the input position and radius. This can fail when there is no navmesh in range.
position  Center of random position circle 
radius  Search a random position inside this radius 
rngSession  The randomization session 
regionMask  The region mask to check 
result  The resulting randomized position. 
Creates a randomized position first, then tries validate it by finding a triangle at the random position. Then the fallback triangle lookup in FindClosestTriangleFast(FPVector2, NavMeshRegionMask) from the candidate and the original position. If all fail, false is returned.
Processing this offline and saving a custom data structure will probably result in more reliable and appealing results.

inline 
Test if the region of the border at index is enabled.
borderIndex  Border index 
regionMask  Region mask 

inline 
Checks if the position is on a navmesh triangle. Does only check the 2D coordinates.
position  Position 
regionMask  Triangle regions are checked if they are active 
inclusive  Set to true if positions exactly on a triangle edge or border are considered to be inside (default is false) 

inline 
This performs a correction of the agent movement against the navmesh borders much like solving physics contacts. This works only in 2D for now. Used internally if NavMeshAgentConfig.ClampAgentToNavmesh is set.
position  Agent current position 
newPosition  Agent future position 
correction  The amount of correction in percent (0..1) 
regionMask  Region mask to check for active borders 

inline 
This performs a correction of the agent movement against the navmesh borders much like solving physics contacts. This works only in 2D for now. Used internally if NavMeshAgentConfig.ClampAgentToNavmesh is set.
frame  Frame 
position  Agent current position 
newPosition  Agent future position 
correction  The amount of correction in percent (0..1) 
regionMask  Region mask to check for active borders 

inline 
This performs a correction of the agent movement against the navmesh borders much like solving physics contacts. This works only in 2D for now. Used internally if NavMeshAgentConfig.ClampAgentToNavmesh is set.
frame  Frame 
position  Agent current position 
newPosition  Agent future position 
correction  The amount of correction in percent (0..1) 
regionMask  Region mask to check for active borders 

inline 
Serializes internal data structures (Triangles, TrianglesGrid, Vertices, BorderGrid, TrianglesCenterGrid, Regions, Borders) from the byte stream. Called during .
stream  Byte stream 
write  Write or read 
String Quantum.NavMesh.Name 
Name of the navmesh. Access the navmesh by name through Map.NavMeshes.
AssetRefBinaryData Quantum.NavMesh.DataAsset 
Asset that contains the actual binary navmesh data.
Int32 Quantum.NavMesh.GridSizeX 
The navmesh triangles are partitioned by simple 2D grid. This is the number of all cells on the xaxis. Derived from the map values during baking.
Int32 Quantum.NavMesh.GridSizeY 
The number of all grid cells on the yaxis. Derived from the map values during baking.
Int32 Quantum.NavMesh.GridNodeSize 
The number of units one grid cell has in both dimensions. Minimum 2. Must be an even number. Derived from the map values during baking.
FPVector2 Quantum.NavMesh.WorldOffset 
The center of the map is the origin. The world offset represents the lower left corner and is copied from Quantum.Map during the navmesh baking.
WorldOffset.X = (GridSizeX * GridNodeSize) / 2
FP Quantum.NavMesh.MinAgentRadius 
The smallest agent radius that the navmesh was created for (to pass visually nicely around the corners).
NavMeshTriangle [] Quantum.NavMesh.Triangles 
Navmesh triangles.
NavMeshTriangleNode [] Quantum.NavMesh.TrianglesGrid 
Per grid cell data structure that holds all indices to triangles inside this cell.
NavMeshVertex [] Quantum.NavMesh.Vertices 
Navmesh vertices referenced by triangles.
NavMeshBorderNode [] Quantum.NavMesh.BorderGrid 
Per grid cell data structure that holds all indices to borders inside this cell.
NavMeshTriangleCenterGridNode [] Quantum.NavMesh.TrianglesCenterGrid 
Per grid cell data structure that holds one (multiple if regions are used) triangle that is somewhat closest to the grid center as a fallback triangle lookup.
NavMeshBorder [] Quantum.NavMesh.Borders 
Navmesh borders.
Int32 Quantum.NavMesh.BorderCount => Borders?.Length ?? 0 
Gets the number of borders.