NavigationMesh
Experimental: This class may be changed or removed in future versions.
Hereda: Resource < RefCounted < Object
Una malla de navegación que define las áreas transitables y los obstáculos.
Descripción
Una malla de navegación es una colección de polígonos que definen qué áreas de un entorno son transitables para ayudar a los agentes en la búsqueda de rutas a través de espacios complicados.
Tutoriales
Propiedades
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Métodos
void |
add_polygon(polygon: PackedInt32Array) |
void |
clear() |
void |
|
void |
create_from_mesh(mesh: Mesh) |
get_collision_mask_value(layer_number: int) const |
|
get_polygon(idx: int) |
|
get_polygon_count() const |
|
get_vertices() const |
|
void |
set_collision_mask_value(layer_number: int, value: bool) |
void |
set_vertices(vertices: PackedVector3Array) |
Enumeraciones
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
Representa el tamaño del enum SamplePartitionType.
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
Representa el tamaño del enum ParsedGeometryType.
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
Representa el tamaño del enum SourceGeometryMode.
Descripciones de Propiedades
La altura mínima del piso al techo que aún permitirá que el área del piso se considere transitable.
Nota: Al hornear, este valor se redondeará al múltiplo más cercano de 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.
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.
Note: The radius must be equal or higher than 0.0. If the radius is 0.0, it won't be possible to fix invalid outline overlaps and other precision errors during the baking process. As a result, some obstacles may be excluded incorrectly from the final navigation mesh, or may delete the navigation mesh's polygons.
The size of the non-navigable border around the bake bounding area.
In conjunction with the filter_baking_aabb and a edge_max_error value at 1.0 or below the border size can be used to bake tile aligned navigation meshes without the tile edges being shrunk by agent_radius.
Note: If this value is not 0.0, it will be rounded up to the nearest multiple of cell_size during baking.
The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map.
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.
The maximum distance a simplified contour's border edges should deviate the original raw contour.
The maximum allowed length for contour edges along the border of the mesh. A value of 0.0 disables this feature.
Note: While baking, this value will be rounded up to the nearest multiple of cell_size.
AABB filter_baking_aabb = AABB(0, 0, 0, 0, 0, 0) 🔗
If the baking AABB has a volume the navigation mesh baking will be restricted to its enclosing area.
Vector3 filter_baking_aabb_offset = Vector3(0, 0, 0) 🔗
The position offset applied to the filter_baking_aabb AABB.
bool filter_ledge_spans = false 🔗
If true, marks spans that are ledges as non-walkable.
bool filter_low_hanging_obstacles = false 🔗
If true, marks non-walkable spans as walkable if their maximum is within agent_max_climb of a walkable neighbor.
bool filter_walkable_low_height_spans = false 🔗
If true, marks walkable spans as not walkable if the clearance above the span is less than agent_height.
int geometry_collision_mask = 4294967295 🔗
The physics layers to scan for static colliders.
Only used when geometry_parsed_geometry_type is PARSED_GEOMETRY_STATIC_COLLIDERS or PARSED_GEOMETRY_BOTH.
ParsedGeometryType geometry_parsed_geometry_type = 2 🔗
void set_parsed_geometry_type(value: ParsedGeometryType)
ParsedGeometryType get_parsed_geometry_type()
Determines which type of nodes will be parsed as geometry.
SourceGeometryMode geometry_source_geometry_mode = 0 🔗
void set_source_geometry_mode(value: SourceGeometryMode)
SourceGeometryMode get_source_geometry_mode()
The source of the geometry used when baking.
StringName geometry_source_group_name = &"navigation_mesh_source_group" 🔗
void set_source_group_name(value: StringName)
StringName get_source_group_name()
The name of the group to scan for geometry.
Only used when geometry_source_geometry_mode is SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN or SOURCE_GEOMETRY_GROUPS_EXPLICIT.
float region_merge_size = 20.0 🔗
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.
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 = 0 🔗
void set_sample_partition_type(value: SamplePartitionType)
SamplePartitionType get_sample_partition_type()
Partitioning algorithm for creating the navigation mesh polys.
float vertices_per_polygon = 6.0 🔗
The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process.
Descripciones de Métodos
void add_polygon(polygon: PackedInt32Array) 🔗
Añade un polígono usando los índices de los vértices que obtienes al llamar a get_vertices().
void clear() 🔗
Limpia los arrays internos para los vértices e índices de polígonos.
void clear_polygons() 🔗
Limpia el array de polígonos, pero no borra el array de vértices.
void create_from_mesh(mesh: Mesh) 🔗
Inicializa la malla de navegación estableciendo los vértices e índices de acuerdo con una Mesh.
Nota: La mesh dada debe ser de tipo Mesh.PRIMITIVE_TRIANGLES y tener un array de índice.
bool get_collision_mask_value(layer_number: int) const 🔗
Devuelve si la capa especificada de la geometry_collision_mask está habilitada o no, dado un layer_number entre 1 y 32.
PackedInt32Array get_polygon(idx: int) 🔗
Devuelve un PackedInt32Array que contiene los índices de los vértices de un polígono creado.
int get_polygon_count() const 🔗
Devuelve el número de polígonos en la malla de navegación.
PackedVector3Array get_vertices() const 🔗
Devuelve un PackedVector3Array que contiene todos los vértices que se están utilizando para crear los polígonos.
void set_collision_mask_value(layer_number: int, value: bool) 🔗
Basado en value, activa o desactiva la capa especificada en la geometry_collision_mask, dado un layer_number entre 1 y 32.
void set_vertices(vertices: PackedVector3Array) 🔗
Establece los vértices que pueden ser indexados para crear polígonos con el método add_polygon().