|
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?>
|
2 | 2 | <class name="NavigationPolygon" inherits="Resource" category="Core" version="3.1">
|
3 | 3 | <brief_description>
|
| 4 | + A node that has methods to draw outlines or use indices of vertices to create navigation polygons. |
4 | 5 | </brief_description>
|
5 | 6 | <description>
|
| 7 | + There are two ways to create polygons. Either by using the [method add_outline] method or using the [method add_polygon] method. |
| 8 | + Using [method add_outline]: |
| 9 | + [code] |
| 10 | + var polygon = NavigationPolygon.new() |
| 11 | + var outline = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) |
| 12 | + polygon.add_outline(outline) |
| 13 | + polygon.make_polygons_from_outlines() |
| 14 | + $NavigationPolygonInstance.navpoly = polygon |
| 15 | + [/code] |
| 16 | + Using [method add_polygon] and indices of the vertices array. |
| 17 | + [code] |
| 18 | + var polygon = NavigationPolygon.new() |
| 19 | + var vertices = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)]) |
| 20 | + polygon.set_vertices(vertices) |
| 21 | + var indices = PoolIntArray(0, 3, 1) |
| 22 | + polygon.add_polygon(indices) |
| 23 | + $NavigationPolygonInstance.navpoly = polygon |
| 24 | + [/code] |
6 | 25 | </description>
|
7 | 26 | <tutorials>
|
8 | 27 | </tutorials>
|
|
15 | 34 | <argument index="0" name="outline" type="PoolVector2Array">
|
16 | 35 | </argument>
|
17 | 36 | <description>
|
| 37 | + Appends a [PoolVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines. You have to call [method make_polygons_from_outlines] in order for this array to be converted to polygons that the engine will use. |
18 | 38 | </description>
|
19 | 39 | </method>
|
20 | 40 | <method name="add_outline_at_index">
|
|
25 | 45 | <argument index="1" name="index" type="int">
|
26 | 46 | </argument>
|
27 | 47 | <description>
|
| 48 | + Adds a [PoolVector2Array] that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position. You have to call [method make_polygons_from_outlines] in order for this array to be converted to polygons that the engine will use. |
28 | 49 | </description>
|
29 | 50 | </method>
|
30 | 51 | <method name="add_polygon">
|
|
33 | 54 | <argument index="0" name="polygon" type="PoolIntArray">
|
34 | 55 | </argument>
|
35 | 56 | <description>
|
| 57 | + Adds a polygon using the indices of the vertices you get when calling [method get_vertices]. |
36 | 58 | </description>
|
37 | 59 | </method>
|
38 | 60 | <method name="clear_outlines">
|
39 | 61 | <return type="void">
|
40 | 62 | </return>
|
41 | 63 | <description>
|
| 64 | + Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them. |
42 | 65 | </description>
|
43 | 66 | </method>
|
44 | 67 | <method name="clear_polygons">
|
45 | 68 | <return type="void">
|
46 | 69 | </return>
|
47 | 70 | <description>
|
| 71 | + Clears the array of polygons, but it doesn't clear the array of outlines and vertices. |
48 | 72 | </description>
|
49 | 73 | </method>
|
50 | 74 | <method name="get_outline" qualifiers="const">
|
|
53 | 77 | <argument index="0" name="idx" type="int">
|
54 | 78 | </argument>
|
55 | 79 | <description>
|
| 80 | + Returns a [PoolVector2Array] containing the vertices of an outline that was created in the editor or by script. |
56 | 81 | </description>
|
57 | 82 | </method>
|
58 | 83 | <method name="get_outline_count" qualifiers="const">
|
59 | 84 | <return type="int">
|
60 | 85 | </return>
|
61 | 86 | <description>
|
| 87 | + Returns the number of outlines that were created in the editor or by script. |
62 | 88 | </description>
|
63 | 89 | </method>
|
64 | 90 | <method name="get_polygon">
|
|
67 | 93 | <argument index="0" name="idx" type="int">
|
68 | 94 | </argument>
|
69 | 95 | <description>
|
| 96 | + Returns a [PoolIntArray] containing the indices of the vertices of a created polygon. |
70 | 97 | </description>
|
71 | 98 | </method>
|
72 | 99 | <method name="get_polygon_count" qualifiers="const">
|
73 | 100 | <return type="int">
|
74 | 101 | </return>
|
75 | 102 | <description>
|
| 103 | + Returns the count of all polygons. |
76 | 104 | </description>
|
77 | 105 | </method>
|
78 | 106 | <method name="get_vertices" qualifiers="const">
|
79 | 107 | <return type="PoolVector2Array">
|
80 | 108 | </return>
|
81 | 109 | <description>
|
| 110 | + Returns a [PoolVector2Array] containing all the vertices being used to create the polygons. |
82 | 111 | </description>
|
83 | 112 | </method>
|
84 | 113 | <method name="make_polygons_from_outlines">
|
85 | 114 | <return type="void">
|
86 | 115 | </return>
|
87 | 116 | <description>
|
| 117 | + Creates polygons from the outlines added in the editor or by script. |
88 | 118 | </description>
|
89 | 119 | </method>
|
90 | 120 | <method name="remove_outline">
|
|
93 | 123 | <argument index="0" name="idx" type="int">
|
94 | 124 | </argument>
|
95 | 125 | <description>
|
| 126 | + Removes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update. |
96 | 127 | </description>
|
97 | 128 | </method>
|
98 | 129 | <method name="set_outline">
|
|
103 | 134 | <argument index="1" name="outline" type="PoolVector2Array">
|
104 | 135 | </argument>
|
105 | 136 | <description>
|
| 137 | + Changes an outline created in the editor or by script. You have to call [method make_polygons_from_outlines] for the polygons to update. |
106 | 138 | </description>
|
107 | 139 | </method>
|
108 | 140 | <method name="set_vertices">
|
|
111 | 143 | <argument index="0" name="vertices" type="PoolVector2Array">
|
112 | 144 | </argument>
|
113 | 145 | <description>
|
| 146 | + Sets the vertices that can be then indexed to create polygons with the [method add_polygon] method. |
114 | 147 | </description>
|
115 | 148 | </method>
|
116 | 149 | </methods>
|
|
0 commit comments