2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								<?xml version="1.0" encoding="UTF-8" ?>  
						 
					
						
							
								
									
										
										
										
											2024-02-12 16:55:02 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								<class  name= "NavigationPolygon"  inherits= "Resource"  experimental= ""  xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation= "../class.xsd" >  
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									<brief_description > 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										A 2D navigation mesh that describes a traversable surface for pathfinding.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									</brief_description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<description > 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										A navigation mesh can be created either by baking it with the help of the [NavigationServer2D], or by adding vertices and convex polygon indices arrays manually.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										To bake a navigation mesh at least one outline needs to be added that defines the outer bounds of the baked area.
							 
						 
					
						
							
								
									
										
										
										
											2020-10-31 18:54:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[codeblocks]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[gdscript]
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										var new_navigation_mesh = NavigationPolygon.new()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var bounding_outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										new_navigation_mesh.add_outline(bounding_outline)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										NavigationServer2D.bake_from_source_geometry_data(new_navigation_mesh, NavigationMeshSourceGeometryData2D.new());
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$NavigationRegion2D.navigation_polygon = new_navigation_mesh
							 
						 
					
						
							
								
									
										
										
										
											2020-10-31 18:54:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[/gdscript]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[csharp]
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										var newNavigationMesh = new NavigationPolygon();
							 
						 
					
						
							
								
									
										
										
										
											2024-12-21 02:28:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Vector2[] boundingOutline = [new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0)];
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										newNavigationMesh.AddOutline(boundingOutline);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										NavigationServer2D.BakeFromSourceGeometryData(newNavigationMesh, new NavigationMeshSourceGeometryData2D());
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										GetNode< NavigationRegion2D> ("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
							 
						 
					
						
							
								
									
										
										
										
											2020-10-31 18:54:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[/csharp]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[/codeblocks]
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Adding vertices and polygon indices manually.
							 
						 
					
						
							
								
									
										
										
										
											2020-10-31 18:54:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[codeblocks]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[gdscript]
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										var new_navigation_mesh = NavigationPolygon.new()
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var new_vertices = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										new_navigation_mesh.vertices = new_vertices
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var new_polygon_indices = PackedInt32Array([0, 1, 2, 3])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										new_navigation_mesh.add_polygon(new_polygon_indices)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$NavigationRegion2D.navigation_polygon = new_navigation_mesh
							 
						 
					
						
							
								
									
										
										
										
											2020-10-31 18:54:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[/gdscript]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[csharp]
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										var newNavigationMesh = new NavigationPolygon();
							 
						 
					
						
							
								
									
										
										
										
											2024-12-21 02:28:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Vector2[] newVertices = [new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0)];
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										newNavigationMesh.Vertices = newVertices;
							 
						 
					
						
							
								
									
										
										
										
											2024-12-21 02:28:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int[] newPolygonIndices = [0, 1, 2, 3];
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										newNavigationMesh.AddPolygon(newPolygonIndices);
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										GetNode< NavigationRegion2D> ("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
							 
						 
					
						
							
								
									
										
										
										
											2020-10-31 18:54:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										[/csharp]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										[/codeblocks]
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<tutorials > 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 06:05:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<link  title= "Using NavigationMeshes" > $DOCS_URL/tutorials/navigation/navigation_using_navigationmeshes.html</link> 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-24 21:20:59 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<link  title= "Navigation Polygon 2D Demo" > https://godotengine.org/asset-library/asset/2722</link> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									</tutorials> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									<methods > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "add_outline" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "outline"  type= "PackedVector2Array"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Appends a [PackedVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "add_outline_at_index" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "outline"  type= "PackedVector2Array"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "1"  name= "index"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Adds a [PackedVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "add_polygon" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "polygon"  type= "PackedInt32Array"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Adds a polygon using the indices of the vertices you get when calling [method get_vertices].
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-07 15:59:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "clear" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Clears the internal arrays for vertices and polygon indices.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										<method  name= "clear_outlines" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "clear_polygons" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Clears the array of polygons, but it doesn't clear the array of outlines and vertices.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-11 18:02:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "get_navigation_mesh" > 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-02 09:25:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "NavigationMesh"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2025-06-04 14:17:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns the [NavigationMesh] resulting from this navigation polygon. This navigation mesh can be used to update the navigation mesh of a region with the [method NavigationServer3D.region_set_navigation_mesh] API directly.
							 
						 
					
						
							
								
									
										
										
										
											2022-06-02 09:25:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										<method  name= "get_outline"  qualifiers= "const" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "PackedVector2Array"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "idx"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-18 13:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns a [PackedVector2Array] containing the vertices of an outline that was created in the editor or by script.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "get_outline_count"  qualifiers= "const" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns the number of outlines that were created in the editor or by script.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "get_parsed_collision_mask_value"  qualifiers= "const" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "bool"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "0"  name= "layer_number"  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Returns whether or not the specified layer of the [member parsed_collision_mask] is enabled, given a [param layer_number] between 1 and 32.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										<method  name= "get_polygon" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "PackedInt32Array"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "idx"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-25 18:10:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns a [PackedInt32Array] containing the indices of the vertices of a created polygon.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "get_polygon_count"  qualifiers= "const" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns the count of all polygons.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-07 08:29:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "get_vertices"  qualifiers= "const" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "PackedVector2Array"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-07 08:29:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-18 13:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Returns a [PackedVector2Array] containing all the vertices being used to create the polygons.
							 
						 
					
						
							
								
									
										
										
										
											2017-12-07 08:29:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-12 16:55:02 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "make_polygons_from_outlines"  deprecated= "Use [method NavigationServer2D.parse_source_geometry_data] and [method NavigationServer2D.bake_from_source_geometry_data] instead." > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Creates polygons from the outlines added in the editor or by script.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "remove_outline" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "idx"  type= "int"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Removes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<method  name= "set_outline" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "idx"  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "1"  name= "outline"  type= "PackedVector2Array"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Changes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update.
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "set_parsed_collision_mask_value" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "0"  name= "layer_number"  type= "int"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<param  index= "1"  name= "value"  type= "bool"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Based on [param value], enables or disables the specified layer in the [member parsed_collision_mask], given a [param layer_number] between 1 and 32.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-07 08:29:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<method  name= "set_vertices" > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-30 15:28:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<return  type= "void"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-06 21:11:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<param  index= "0"  name= "vertices"  type= "PackedVector2Array"  /> 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-07 08:29:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											<description > 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-21 20:38:57 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Sets the vertices that can be then indexed to create polygons with the [method add_polygon] method.
							 
						 
					
						
							
								
									
										
										
										
											2017-12-07 08:29:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											</description> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</method> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									</methods> 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-13 10:35:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									<members > 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<member  name= "agent_radius"  type= "float"  setter= "set_agent_radius"  getter= "get_agent_radius"  default= "10.0" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											The distance to erode/shrink the walkable surface when baking the navigation mesh.
							 
						 
					
						
							
								
									
										
										
										
											2025-06-23 10:23:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											[b]Note:[/b] The radius must be equal or higher than [code]0.0[/code]. If the radius is [code]0.0[/code], 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.
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-04 18:54:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<member  name= "baking_rect"  type= "Rect2"  setter= "set_baking_rect"  getter= "get_baking_rect"  default= "Rect2(0, 0, 0, 0)" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											If the baking [Rect2] has an area the navigation mesh baking will be restricted to its enclosing area.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<member  name= "baking_rect_offset"  type= "Vector2"  setter= "set_baking_rect_offset"  getter= "get_baking_rect_offset"  default= "Vector2(0, 0)" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											The position offset applied to the [member baking_rect] [Rect2].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<member  name= "border_size"  type= "float"  setter= "set_border_size"  getter= "get_border_size"  default= "0.0" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											The size of the non-navigable border around the bake bounding area defined by the [member baking_rect] [Rect2].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											In conjunction with the [member baking_rect] the border size can be used to bake tile aligned navigation meshes without the tile edges being shrunk by [member agent_radius].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-13 10:35:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<member  name= "cell_size"  type= "float"  setter= "set_cell_size"  getter= "get_cell_size"  default= "1.0" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											The cell size used to rasterize the navigation mesh vertices. Must match with the cell size on the navigation map.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<member  name= "parsed_collision_mask"  type= "int"  setter= "set_parsed_collision_mask"  getter= "get_parsed_collision_mask"  default= "4294967295" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											The physics layers to scan for static colliders.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Only used when [member parsed_geometry_type] is [constant PARSED_GEOMETRY_STATIC_COLLIDERS] or [constant PARSED_GEOMETRY_BOTH].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<member  name= "parsed_geometry_type"  type= "int"  setter= "set_parsed_geometry_type"  getter= "get_parsed_geometry_type"  enum= "NavigationPolygon.ParsedGeometryType"  default= "2" > 
							 
						 
					
						
							
								
									
										
										
										
											2025-05-08 11:56:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Determines which type of nodes will be parsed as geometry.
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-30 15:01:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<member  name= "sample_partition_type"  type= "int"  setter= "set_sample_partition_type"  getter= "get_sample_partition_type"  enum= "NavigationPolygon.SamplePartitionType"  default= "0" > 
							 
						 
					
						
							
								
									
										
										
										
											2025-05-08 11:56:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Partitioning algorithm for creating the navigation mesh polys.
							 
						 
					
						
							
								
									
										
										
										
											2024-05-30 15:01:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<member  name= "source_geometry_group_name"  type= "StringName"  setter= "set_source_geometry_group_name"  getter= "get_source_geometry_group_name"  default= "&"navigation_polygon_source_geometry_group"" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											The group name of nodes that should be parsed for baking source geometry.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Only used when [member source_geometry_mode] is [constant SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN] or [constant SOURCE_GEOMETRY_GROUPS_EXPLICIT].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<member  name= "source_geometry_mode"  type= "int"  setter= "set_source_geometry_mode"  getter= "get_source_geometry_mode"  enum= "NavigationPolygon.SourceGeometryMode"  default= "0" > 
							 
						 
					
						
							
								
									
										
										
										
											2025-05-08 11:56:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											The source of the geometry used when baking.
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										</member> 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-13 10:35:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									</members> 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									<constants > 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-30 15:01:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<constant  name= "SAMPLE_PARTITION_CONVEX_PARTITION"  value= "0"  enum= "SamplePartitionType" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Convex partitioning that yields navigation mesh with convex polygons.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "SAMPLE_PARTITION_TRIANGULATE"  value= "1"  enum= "SamplePartitionType" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Triangulation partitioning that yields navigation mesh with triangle polygons.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "SAMPLE_PARTITION_MAX"  value= "2"  enum= "SamplePartitionType" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Represents the size of the [enum SamplePartitionType] enum.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-17 18:32:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										<constant  name= "PARSED_GEOMETRY_MESH_INSTANCES"  value= "0"  enum= "ParsedGeometryType" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Parses mesh instances as obstruction geometry. This includes [Polygon2D], [MeshInstance2D], [MultiMeshInstance2D], and [TileMap] nodes.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Meshes are only parsed when they use a 2D vertices surface format.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "PARSED_GEOMETRY_STATIC_COLLIDERS"  value= "1"  enum= "ParsedGeometryType" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Parses [StaticBody2D] and [TileMap] colliders as obstruction geometry. The collider should be in any of the layers specified by [member parsed_collision_mask].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "PARSED_GEOMETRY_BOTH"  value= "2"  enum= "ParsedGeometryType" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Both [constant PARSED_GEOMETRY_MESH_INSTANCES] and [constant PARSED_GEOMETRY_STATIC_COLLIDERS].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "PARSED_GEOMETRY_MAX"  value= "3"  enum= "ParsedGeometryType" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Represents the size of the [enum ParsedGeometryType] enum.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "SOURCE_GEOMETRY_ROOT_NODE_CHILDREN"  value= "0"  enum= "SourceGeometryMode" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Scans the child nodes of the root node recursively for geometry.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN"  value= "1"  enum= "SourceGeometryMode" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Scans nodes in a group and their child nodes recursively for geometry. The group is specified by [member source_geometry_group_name].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "SOURCE_GEOMETRY_GROUPS_EXPLICIT"  value= "2"  enum= "SourceGeometryMode" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Uses nodes in a group for geometry. The group is specified by [member source_geometry_group_name].
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										<constant  name= "SOURCE_GEOMETRY_MAX"  value= "3"  enum= "SourceGeometryMode" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Represents the size of the [enum SourceGeometryMode] enum.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</constant> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</constants> 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 17:42:36 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								</class>