diff options
Diffstat (limited to 'doc/classes/NavigationPolygon.xml')
-rw-r--r-- | doc/classes/NavigationPolygon.xml | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/doc/classes/NavigationPolygon.xml b/doc/classes/NavigationPolygon.xml index b0f77dff83..38921078d7 100644 --- a/doc/classes/NavigationPolygon.xml +++ b/doc/classes/NavigationPolygon.xml @@ -6,24 +6,44 @@ <description> There are two ways to create polygons. Either by using the [method add_outline] method, or using the [method add_polygon] method. Using [method add_outline]: - [codeblock] + [codeblocks] + [gdscript] var polygon = NavigationPolygon.new() var outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) polygon.add_outline(outline) polygon.make_polygons_from_outlines() $NavigationRegion2D.navpoly = polygon - [/codeblock] + [/gdscript] + [csharp] + var polygon = new NavigationPolygon(); + var outline = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) }; + polygon.AddOutline(outline); + polygon.MakePolygonsFromOutlines(); + GetNode<NavigationRegion2D>("NavigationRegion2D").Navpoly = polygon; + [/csharp] + [/codeblocks] Using [method add_polygon] and indices of the vertices array. - [codeblock] + [codeblocks] + [gdscript] var polygon = NavigationPolygon.new() var vertices = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) - polygon.set_vertices(vertices) + polygon.vertices = vertices var indices = PackedInt32Array(0, 3, 1) polygon.add_polygon(indices) $NavigationRegion2D.navpoly = polygon - [/codeblock] + [/gdscript] + [csharp] + var polygon = new NavigationPolygon(); + var vertices = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) }; + polygon.Vertices = vertices; + var indices = new int[] { 0, 3, 1 }; + polygon.AddPolygon(indices); + GetNode<NavigationRegion2D>("NavigationRegion2D").Navpoly = polygon; + [/csharp] + [/codeblocks] </description> <tutorials> + <link title="2D Navigation Demo">https://godotengine.org/asset-library/asset/117</link> </tutorials> <methods> <method name="add_outline"> |