2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2018-02-27 13:40:43 +01:00
<class name= "NavigationPolygon" inherits= "Resource" category= "Core" version= "3.1" >
2017-09-12 22:42:36 +02:00
<brief_description >
2018-10-21 19:38:57 +02:00
A node that has methods to draw outlines or use indices of vertices to create navigation polygons.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2018-10-21 19:38:57 +02:00
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]:
2019-01-07 11:46:26 +01:00
[codeblock]
2018-10-21 19:38:57 +02:00
var polygon = NavigationPolygon.new()
var outline = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
polygon.add_outline(outline)
polygon.make_polygons_from_outlines()
$NavigationPolygonInstance.navpoly = polygon
2019-01-07 11:46:26 +01:00
[/codeblock]
2018-10-21 19:38:57 +02:00
Using [method add_polygon] and indices of the vertices array.
2019-01-07 11:46:26 +01:00
[codeblock]
2018-10-21 19:38:57 +02:00
var polygon = NavigationPolygon.new()
var vertices = PoolVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
polygon.set_vertices(vertices)
var indices = PoolIntArray(0, 3, 1)
polygon.add_polygon(indices)
$NavigationPolygonInstance.navpoly = polygon
2019-01-07 11:46:26 +01:00
[/codeblock]
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
</tutorials>
<demos >
</demos>
<methods >
<method name= "add_outline" >
<return type= "void" >
</return>
<argument index= "0" name= "outline" type= "PoolVector2Array" >
</argument>
<description >
2018-10-21 19:38:57 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "add_outline_at_index" >
<return type= "void" >
</return>
<argument index= "0" name= "outline" type= "PoolVector2Array" >
</argument>
<argument index= "1" name= "index" type= "int" >
</argument>
<description >
2018-10-21 19:38:57 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "add_polygon" >
<return type= "void" >
</return>
<argument index= "0" name= "polygon" type= "PoolIntArray" >
</argument>
<description >
2018-10-21 19:38:57 +02:00
Adds a polygon using the indices of the vertices you get when calling [method get_vertices].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "clear_outlines" >
<return type= "void" >
</return>
<description >
2018-10-21 19:38:57 +02: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 22:42:36 +02:00
</description>
</method>
<method name= "clear_polygons" >
<return type= "void" >
</return>
<description >
2018-10-21 19:38:57 +02:00
Clears the array of polygons, but it doesn't clear the array of outlines and vertices.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_outline" qualifiers= "const" >
<return type= "PoolVector2Array" >
</return>
<argument index= "0" name= "idx" type= "int" >
</argument>
<description >
2018-10-21 19:38:57 +02:00
Returns a [PoolVector2Array] containing the vertices of an outline that was created in the editor or by script.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_outline_count" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2018-10-21 19:38:57 +02:00
Returns the number of outlines that were created in the editor or by script.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_polygon" >
<return type= "PoolIntArray" >
</return>
<argument index= "0" name= "idx" type= "int" >
</argument>
<description >
2018-10-21 19:38:57 +02:00
Returns a [PoolIntArray] containing the indices of the vertices of a created polygon.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_polygon_count" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2018-10-21 19:38:57 +02:00
Returns the count of all polygons.
2017-09-12 22:42:36 +02:00
</description>
</method>
2017-12-07 08:29:38 +01:00
<method name= "get_vertices" qualifiers= "const" >
<return type= "PoolVector2Array" >
</return>
<description >
2018-10-21 19:38:57 +02:00
Returns a [PoolVector2Array] containing all the vertices being used to create the polygons.
2017-12-07 08:29:38 +01:00
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "make_polygons_from_outlines" >
<return type= "void" >
</return>
<description >
2018-10-21 19:38:57 +02:00
Creates polygons from the outlines added in the editor or by script.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "remove_outline" >
<return type= "void" >
</return>
<argument index= "0" name= "idx" type= "int" >
</argument>
<description >
2018-10-21 19:38:57 +02: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 22:42:36 +02:00
</description>
</method>
<method name= "set_outline" >
<return type= "void" >
</return>
<argument index= "0" name= "idx" type= "int" >
</argument>
<argument index= "1" name= "outline" type= "PoolVector2Array" >
</argument>
<description >
2018-10-21 19:38:57 +02: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 22:42:36 +02:00
</description>
</method>
2017-12-07 08:29:38 +01:00
<method name= "set_vertices" >
<return type= "void" >
</return>
<argument index= "0" name= "vertices" type= "PoolVector2Array" >
</argument>
<description >
2018-10-21 19:38:57 +02: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 22:42:36 +02:00
</methods>
<constants >
</constants>
</class>