NavigationMesh
Inherits: Resource < Reference < Object A mesh to approximate the walkable areas and obstacles.
Description
A navigation mesh is a collection of polygons that define which areas of an environment are traversable to aid agents in pathfinding through complicated spaces.
Tutorials
- 3D Navmesh Demo
Properties
Methods
Enumerations
SamplePartitionType: - SAMPLE_PARTITION_WATERSHED = 0 —- Watershed partitioning. Generally the best choice if you precompute the navigation mesh, use this if you have large open areas.
- SAMPLE_PARTITION_MONOTONE = 1 —- Monotone partitioning. Use this if you want fast navigation mesh generation.
- SAMPLE_PARTITION_LAYERS = 2 —- Layer partitioning. Good choice to use for tiled navigation mesh with medium and small sized tiles.
- SAMPLE_PARTITION_MAX = 3 —- Represents the size of the SamplePartitionType enum.
ParsedGeometryType:
- PARSED_GEOMETRY_MESH_INSTANCES = 0 —- Parses mesh instances as geometry. This includes MeshInstance, CSGShape, and GridMap nodes.
- PARSED_GEOMETRY_STATIC_COLLIDERS = 1 —- Parses StaticBody colliders as geometry. The collider should be in any of the layers specified by geometry/collision_mask.
- PARSED_GEOMETRY_BOTH = 2 —- Both PARSED_GEOMETRY_MESH_INSTANCES and PARSED_GEOMETRY_STATIC_COLLIDERS.
- PARSED_GEOMETRY_MAX = 3 —- Represents the size of the ParsedGeometryType enum.
SourceGeometryMode:
- SOURCE_GEOMETRY_NAVMESH_CHILDREN = 0 —- Scans the child nodes of NavigationMeshInstance recursively for geometry.
- SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN = 1 —- Scans nodes in a group and their child nodes recursively for geometry. The group is specified by geometry/source_group_name.
- SOURCE_GEOMETRY_GROUPS_EXPLICIT = 2 —- Uses nodes in a group for geometry. The group is specified by geometry/source_group_name.
- SOURCE_GEOMETRY_MAX = 3 —- Represents the size of the SourceGeometryMode enum.
Property Descriptions
- float agent/height The minimum floor to ceiling height that will still allow the floor area to be considered walkable. Note: While baking, this value will be rounded up to the nearest multiple of cell/height.
- float agent/max_climb The minimum ledge height that is considered to still be traversable. Note: While baking, this value will be rounded down to the nearest multiple of cell/height.
- float agent/max_slope The maximum slope that is considered walkable, in degrees.
- float agent/radius The distance to erode/shrink the walkable area of the heightfield away from obstructions. Note: While baking, this value will be rounded up to the nearest multiple of cell/size.
- float cell/height The Y axis cell size to use for fields.
- float cell/size The XZ plane cell size to use for fields.
- float detail/sample_distance The sampling distance to use when generating the detail mesh, in cell unit.
- float detail/sample_max_error The maximum distance the detail mesh surface should deviate from heightfield, in cell unit.
- float edge/max_error The maximum distance a simplfied contour’s border edges should deviate the original raw contour.
- float edge/max_length The maximum allowed length for contour edges along the border of the mesh. Note: While baking, this value will be rounded up to the nearest multiple of cell/size.
- bool filter/filter_walkable_low_height_spans
true, marks walkable spans as not walkable if the clearance above the span is less than agent/height.
- bool filter/ledge_spans
true, marks spans that are ledges as non-walkable.
- bool filter/low_hanging_obstacles
true, marks non-walkable spans as walkable if their maximum is within agent/max_climb of a walkable neighbor.
- int geometry/collision_mask The physics layers to scan for static colliders. geometry/parsed_geometry_type is PARSED_GEOMETRY_STATIC_COLLIDERS or PARSED_GEOMETRY_BOTH.
- ParsedGeometryType geometry/parsed_geometry_type ParsedGeometryType for possible values.
- SourceGeometryMode geometry/source_geometry_mode SourceGeometryMode for possible values.
- String geometry/source_group_name The name of the group to scan for geometry. geometry/source_geometry_mode is SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN or SOURCE_GEOMETRY_GROUPS_EXPLICIT.
- float polygon/verts_per_poly The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process.
- float region/merge_size Any regions with a size smaller than this will be merged with larger regions if possible. Note: This value will be squared to calculate the number of cells. For example, a value of 20 will set the number of cells to 400.
- float region/min_size The minimum size of a region for it to be created. Note: This value will be squared to calculate the minimum number of cells allowed to form isolated island areas. For example, a value of 8 will set the number of cells to 64.
- SamplePartitionType sample_partition_type/sample_partition_type
SamplePartitionType for possible values.
Method Descriptions
- add_polygon ( PoolIntArray polygon ) get_vertices.
- clear_polygons ( ) Clears the array of polygons, but it doesn’t clear the array of vertices.
- create_from_mesh ( Mesh mesh ) Mesh.
- bool get_collision_mask_bit ( int bit ) const
bitof the geometry/collision_mask is set.
- PoolIntArray get_polygon ( int idx ) PoolIntArray containing the indices of the vertices of a created polygon.
- int get_polygon_count ( ) const Returns the number of polygons in the navigation mesh.
- PoolVector3Array get_vertices ( ) const PoolVector3Array containing all the vertices being used to create the polygons.
- set_collision_mask_bit ( int bit, bool value )
valueistrue, sets the specifiedbitin the geometry/collision_mask.valueisfalse, clears the specifiedbitin the geometry/collision_mask.
- set_vertices ( PoolVector3Array vertices ) add_polygon method.
