From NeoAxis 3D Engine Wiki
|Language:||English • Russian||Status:||Approved|
RecastNavigationSystem is used for finding a path between two points using Navigation Mesh technology. Navigation Mesh is a precalculated graph, which replicates the surface of the landscape, that is available for character movement. The name Recast was originally taken from the framework with similar name, which implements the functionality of this entity.
The map Demos\PathfindingDemo\Maps\Example\Map.map is a good example of the usage of this entity.
In order to add RecastNavigationSystem to the map, you have to open Entity Types window, select proper type in Types\Special folder and click on the workspace.
For further adjustment you have to select this type on Map Entities list.
The properties of RecastNavigationSystem and four buttons will become available in Properties window after that action:
- Rebuild - rebuild the navigation mesh,
- Clear - delete the navigation mesh,
- Collision - change the list of currently used geometry,
- Test - test path finding.
Setting up geometry
After clicking on Collision button, Collision Objects window will be opened. You have to choose entities, that will be used for the calculation of navigation mesh.
The entity could be added or removed from the list using Geometry Selection Mode, which is activated by clicking on Select Objects button, then you have to select entities using mouse click. All entities, that have collision physics (static physics body) are available for the selection. Such entity types are terrain, static meshes and entity objects with enabled collision.
Also there are other buttons in Recast Geometries window:
- Add All Objects - add all objects of the map to the geometry list,
- Clear - clear the list,
- Calculate Bounds - calculate bounds of navigation mesh.
Calculate Bounds button is useful for automatic calculation of the bounds of navigation mesh after editing of the entity list. The bounds of navigation mesh could be set manually using BoundMax and BoundMin properties, that are described here.
Rebuild button, which is placed below properties section, is used for calculation and recalculation of the navigation mesh. The navigation mesh is immediately re-rendered in Map Editor after every calculation.
Clear button is used for removal of the calculated navigation mesh.
Test button is used for pathfinding check. Pathfinding Test window will appear after pressing this button. For the demonstration of pathfinding on the map, you have to move mouse cursor to the place of the beginning of the path and then start to move the cursor on the map, holding left mouse button. The path between two points will be drawn, while the mouse button is held.
There are several parameters for the test of navigation mesh, they are shown in the window:
|Step size||Step size. The length of the path between two points.|
|Polygon pick extents||Maximum distance to the nearest polygon of the mesh, if the starting point is placed at some distance from the mesh.|
|Max polygon path||Maximum number of polygons in the path. If the path runs through bigger count of polygons, then the way will not be found.|
|Max smooth path||Maximum number of points of the path.|
|Max steer points||Maximum number of steering points, used in pathfinding.|
|AgentHeight||Minimum height under which the character could pass.|
|AgentMaxClimb||Maximum height between mesh cells on which the character could climb.|
|AgentMaxSlope||Maximum slope angle on which the character could go down. Its value should be set in degrees.|
|AgentRadius||The radius of bounding sphere of the character.|
|Components||List of attached components.|
|LogicClass||Reference to the Logic Editor class. Read more about how to work with the Logic Editor class.|
|Tags||User defined information. Defined as key — value pairs. It is used for user's needs.|
|Type||Object type. It can not be changed.|
|AlwaysDrawNavMesh||Switching on of constant drawing of the navigation mesh. True value means that the mesh is always drawn. This property is used for debug purposes.|
|DetailMaxSampleError||Maximum error distance between the surface of detail mesh and original geometry.|
|DetailSampleDistance||This property regulates the size of sampling, which is used for comparison of detail mesh and original geometry. Also this property affects on similarity of the shapes of detail mesh and original geometry. Higher values make detail mesh look closer to the original geometry, but increase triangle count of the mesh, which means much more load on CPU and more time for pathfinding calculations.|
|BoundsMax||Maximum X, Y, Z values for bounding points of NavMesh.|
|BoundsMin||Minimum X, Y, Z values for bounding points of NavMesh.|
|CellHeight||The height of the cell which is used during sampling of original geometry. The height of the voxel, it is used for voxel fragmentation.|
|CellSize||The width and depth of the cell that is used for the sampling of original geometry. The width and depth of the voxel that is used for voxel fragmentation. The width and depth of the cell that describes the base of the row, which is used for voxel fragmentation. Lower values of this property make generated mesh look closer to the original geometry, but also increase CPU usage and memory usage for calculations.|
|TrianglesPerChunck||Maximum triangle count of each block of inner bounding boxes tree (AABB).|
|PathfindingMaxNodes||The maximum number of points, used for building pathfinding curve.|
|MaxEdgeError||Maximum distance between the edges of the mesh and original geometry. Lower values of this property increase the precision of built mesh, but also increase the triangle count of this mesh.|
|MaxEdgeLength||Maximum length of bounding edges of the mesh. If the value of this property exceeds the length of a separate edge then new vertexes will be added to the boundary. 0 value turns off this function.|
|MaxVerticesPerPolygon||Maximum vertex count for each polygon.|
|MergeRegionSize||If the size of the region is less than this value, the region will be merged with bigger region. The value of this property should be set in voxels. This option allows to decrease the number of small regions.|
|MinRegionSize||Minimum size of a separate region, which is not connected to others. The value should be set in voxels. The regions that are not connected to others and have smaller size, than the value of this property, will be excluded from the calculation, until the generation of NavMesh starts. These regions will not be available for pathfinding in such way.|
|MonotonePartitioning||This property determines, will be the surfaces, that are enabled for passing, partitioned as simple monotone regions.|