| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="NavigationRegion2D" inherits="Node2D" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A traversable 2D region that [NavigationAgent2D]s can use for pathfinding. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | A traversable 2D region based on a [NavigationPolygon] that [NavigationAgent2D]s can use for pathfinding. |
| 8 | Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using [method NavigationServer2D.map_set_edge_connection_margin]. |
| 9 | [b]Note:[/b] Overlapping two regions' navigation polygons is not enough for connecting two regions. They must share a similar edge. |
| 10 | The pathfinding cost of entering a region from another region can be controlled with the [member enter_cost] value. |
| 11 | [b]Note:[/b] This value is not added to the path cost when the start position is already inside this region. |
| 12 | The pathfinding cost of traveling distances inside this region can be controlled with the [member travel_cost] multiplier. |
| 13 | [b]Note:[/b] This node caches changes to its properties, so if you make changes to the underlying region [RID] in [NavigationServer2D], they will not be reflected in this node's properties. |
| 14 | </description> |
| 15 | <tutorials> |
| 16 | <link title="Using NavigationRegions">$DOCS_URL/tutorials/navigation/navigation_using_navigationregions.html</link> |
| 17 | </tutorials> |
| 18 | <methods> |
| 19 | <method name="bake_navigation_polygon"> |
| 20 | <return type="void" /> |
| 21 | <param index="0" name="on_thread" type="bool" default="true" /> |
| 22 | <description> |
| 23 | Bakes the [NavigationPolygon]. If [param on_thread] is set to [code]true[/code] (default), the baking is done on a separate thread. |
| 24 | </description> |
| 25 | </method> |
| 26 | <method name="get_bounds" qualifiers="const"> |
| 27 | <return type="Rect2" /> |
| 28 | <description> |
| 29 | Returns the axis-aligned rectangle for the region's transformed navigation mesh. |
| 30 | </description> |
| 31 | </method> |
| 32 | <method name="get_navigation_layer_value" qualifiers="const"> |
| 33 | <return type="bool" /> |
| 34 | <param index="0" name="layer_number" type="int" /> |
| 35 | <description> |
| 36 | Returns whether or not the specified layer of the [member navigation_layers] bitmask is enabled, given a [param layer_number] between 1 and 32. |
| 37 | </description> |
| 38 | </method> |
| 39 | <method name="get_navigation_map" qualifiers="const"> |
| 40 | <return type="RID" /> |
| 41 | <description> |
| 42 | Returns the current navigation map [RID] used by this region. |
| 43 | </description> |
| 44 | </method> |
| 45 | <method name="get_region_rid" qualifiers="const" deprecated="Use [method get_rid] instead."> |
| 46 | <return type="RID" /> |
| 47 | <description> |
| 48 | Returns the [RID] of this region on the [NavigationServer2D]. |
| 49 | </description> |
| 50 | </method> |
| 51 | <method name="get_rid" qualifiers="const"> |
| 52 | <return type="RID" /> |
| 53 | <description> |
| 54 | Returns the [RID] of this region on the [NavigationServer2D]. Combined with [method NavigationServer2D.map_get_closest_point_owner] can be used to identify the [NavigationRegion2D] closest to a point on the merged navigation map. |
| 55 | </description> |
| 56 | </method> |
| 57 | <method name="is_baking" qualifiers="const"> |
| 58 | <return type="bool" /> |
| 59 | <description> |
| 60 | Returns [code]true[/code] when the [NavigationPolygon] is being baked on a background thread. |
| 61 | </description> |
| 62 | </method> |
| 63 | <method name="set_navigation_layer_value"> |
| 64 | <return type="void" /> |
| 65 | <param index="0" name="layer_number" type="int" /> |
| 66 | <param index="1" name="value" type="bool" /> |
| 67 | <description> |
| 68 | Based on [param value], enables or disables the specified layer in the [member navigation_layers] bitmask, given a [param layer_number] between 1 and 32. |
| 69 | </description> |
| 70 | </method> |
| 71 | <method name="set_navigation_map"> |
| 72 | <return type="void" /> |
| 73 | <param index="0" name="navigation_map" type="RID" /> |
| 74 | <description> |
| 75 | Sets the [RID] of the navigation map this region should use. By default the region will automatically join the [World2D] default navigation map so this function is only required to override the default map. |
| 76 | </description> |
| 77 | </method> |
| 78 | </methods> |
| 79 | <members> |
| 80 | <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true"> |
| 81 | Determines if the [NavigationRegion2D] is enabled or disabled. |
| 82 | </member> |
| 83 | <member name="enter_cost" type="float" setter="set_enter_cost" getter="get_enter_cost" default="0.0"> |
| 84 | When pathfinding enters this region's navigation mesh from another regions navigation mesh the [member enter_cost] value is added to the path distance for determining the shortest path. |
| 85 | </member> |
| 86 | <member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1"> |
| 87 | A bitfield determining all navigation layers the region belongs to. These navigation layers can be checked upon when requesting a path with [method NavigationServer2D.map_get_path]. |
| 88 | </member> |
| 89 | <member name="navigation_polygon" type="NavigationPolygon" setter="set_navigation_polygon" getter="get_navigation_polygon"> |
| 90 | The [NavigationPolygon] resource to use. |
| 91 | </member> |
| 92 | <member name="travel_cost" type="float" setter="set_travel_cost" getter="get_travel_cost" default="1.0"> |
| 93 | When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with [member travel_cost] for determining the shortest path. |
| 94 | </member> |
| 95 | <member name="use_edge_connections" type="bool" setter="set_use_edge_connections" getter="get_use_edge_connections" default="true"> |
| 96 | If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin. |
| 97 | </member> |
| 98 | </members> |
| 99 | <signals> |
| 100 | <signal name="bake_finished"> |
| 101 | <description> |
| 102 | Emitted when a navigation polygon bake operation is completed. |
| 103 | </description> |
| 104 | </signal> |
| 105 | <signal name="navigation_polygon_changed"> |
| 106 | <description> |
| 107 | Emitted when the used navigation polygon is replaced or changes to the internals of the current navigation polygon are committed. |
| 108 | </description> |
| 109 | </signal> |
| 110 | </signals> |
| 111 | </class> |