Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
NavigationMesh¶
Inherits: Resource < RefCounted < Object
A navigation mesh that defines traversable 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¶
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
void |
add_polygon ( PackedInt32Array polygon ) |
void |
clear ( ) |
void |
clear_polygons ( ) |
void |
create_from_mesh ( Mesh mesh ) |
get_collision_mask_value ( int layer_number ) const |
|
get_polygon ( int idx ) |
|
get_polygon_count ( ) const |
|
get_vertices ( ) const |
|
void |
set_collision_mask_value ( int layer_number, bool value ) |
void |
set_vertices ( PackedVector3Array vertices ) |
Enumerations¶
enum SamplePartitionType:
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.
SamplePartitionType SAMPLE_PARTITION_MONOTONE = 1
Monotone partitioning. Use this if you want fast navigation mesh generation.
SamplePartitionType SAMPLE_PARTITION_LAYERS = 2
Layer partitioning. Good choice to use for tiled navigation mesh with medium and small sized tiles.
SamplePartitionType SAMPLE_PARTITION_MAX = 3
Represents the size of the SamplePartitionType enum.
enum ParsedGeometryType:
ParsedGeometryType PARSED_GEOMETRY_MESH_INSTANCES = 0
Parses mesh instances as geometry. This includes MeshInstance3D, CSGShape3D, and GridMap nodes.
ParsedGeometryType PARSED_GEOMETRY_STATIC_COLLIDERS = 1
Parses StaticBody3D colliders as geometry. The collider should be in any of the layers specified by geometry_collision_mask.
ParsedGeometryType PARSED_GEOMETRY_BOTH = 2
Both PARSED_GEOMETRY_MESH_INSTANCES and PARSED_GEOMETRY_STATIC_COLLIDERS.
ParsedGeometryType PARSED_GEOMETRY_MAX = 3
Represents the size of the ParsedGeometryType enum.
enum SourceGeometryMode:
SourceGeometryMode SOURCE_GEOMETRY_ROOT_NODE_CHILDREN = 0
Scans the child nodes of the root node recursively for geometry.
SourceGeometryMode 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.
SourceGeometryMode SOURCE_GEOMETRY_GROUPS_EXPLICIT = 2
Uses nodes in a group for geometry. The group is specified by geometry_source_group_name.
SourceGeometryMode SOURCE_GEOMETRY_MAX = 3
Represents the size of the SourceGeometryMode enum.
Property Descriptions¶
float agent_height = 1.5
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 = 0.25
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 = 45.0
The maximum slope that is considered walkable, in degrees.
float agent_radius = 0.5
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 = 0.25
The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map.
float cell_size = 0.25
The cell size used to rasterize the navigation mesh vertices on the XZ plane. Must match with the cell size on the navigation map.
float detail_sample_distance = 6.0
The sampling distance to use when generating the detail mesh, in cell unit.
float detail_sample_max_error = 1.0
The maximum distance the detail mesh surface should deviate from heightfield, in cell unit.
float edge_max_error = 1.3