Răsfoiți Sursa

Merge pull request #61623 from smix8/navigation_navpoly_getmesh_4.x

Rémi Verschelde 3 ani în urmă
părinte
comite
798b39ed44
2 a modificat fișierele cu 7 adăugiri și 0 ștergeri
  1. 6 0
      doc/classes/NavigationPolygon.xml
  2. 1 0
      scene/2d/navigation_region_2d.cpp

+ 6 - 0
doc/classes/NavigationPolygon.xml

@@ -80,6 +80,12 @@
 				Clears the array of polygons, but it doesn't clear the array of outlines and vertices.
 			</description>
 		</method>
+		<method name="get_mesh">
+			<return type="NavigationMesh" />
+			<description>
+				Returns the [NavigationMesh] resulting from this navigation polygon. This navmesh can be used to update the navmesh of a region with the [method NavigationServer3D.region_set_navmesh] API directly (as 2D uses the 3D server behind the scene).
+			</description>
+		</method>
 		<method name="get_outline" qualifiers="const">
 			<return type="PackedVector2Array" />
 			<argument index="0" name="idx" type="int" />

+ 1 - 0
scene/2d/navigation_region_2d.cpp

@@ -331,6 +331,7 @@ void NavigationPolygon::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("get_polygon_count"), &NavigationPolygon::get_polygon_count);
 	ClassDB::bind_method(D_METHOD("get_polygon", "idx"), &NavigationPolygon::get_polygon);
 	ClassDB::bind_method(D_METHOD("clear_polygons"), &NavigationPolygon::clear_polygons);
+	ClassDB::bind_method(D_METHOD("get_mesh"), &NavigationPolygon::get_mesh);
 
 	ClassDB::bind_method(D_METHOD("add_outline", "outline"), &NavigationPolygon::add_outline);
 	ClassDB::bind_method(D_METHOD("add_outline_at_index", "outline", "index"), &NavigationPolygon::add_outline_at_index);