diff options
Diffstat (limited to 'doc/classes/NavigationServer2D.xml')
-rw-r--r-- | doc/classes/NavigationServer2D.xml | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index 5f0b04487e..4f34a8a424 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -4,7 +4,12 @@ Server interface for low-level 2D navigation access </brief_description> <description> - NavigationServer2D is the server responsible for all 2D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying. + NavigationServer2D is the server responsible for all 2D navigation. It handles several objects, namely maps, regions and agents. + Maps are made up of regions, which are made of navigation polygons. Together, they define the navigable areas in the 2D world. For two regions to be connected to each other, they must share a similar edge. An edges is considered connected to another if both of its two vertices are at a distance less than [code]edge_connection_margin[/code] to the respective other edge's vertex. + You may assign navigation layers to regions with [method NavigationServer2D.region_set_layers], which then can be checked upon when requesting a path with [method NavigationServer2D.map_get_path]. This allows allowing or forbidding some areas to 2D objects. + To use the collision avoidance system, you may use agents. You can set an agent's target velocity, then the servers will emit a callback with a modified velocity. + [b]Note:[/b] the collision avoidance system ignores regions. Using the modified velocity as-is might lead to pushing and agent outside of a navigable area. This is a limitation of the collision avoidance system, any more complex situation may require the use of the physics engine. + This server keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying. </description> <tutorials> <link title="2D Navigation Demo">https://godotengine.org/asset-library/asset/117</link> @@ -207,8 +212,10 @@ </argument> <argument index="3" name="optimize" type="bool"> </argument> + <argument index="4" name="layers" type="int" default="1"> + </argument> <description> - Returns the navigation path to reach the destination from the origin, while avoiding static obstacles. + Returns the navigation path to reach the destination from the origin. [code]layers[/code] is a bitmask of all region layers that are allowed to be in the path. </description> </method> <method name="map_is_active" qualifiers="const"> @@ -260,6 +267,26 @@ Creates a new region. </description> </method> + <method name="region_get_layers" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="region" type="RID"> + </argument> + <description> + Returns the region's layers. + </description> + </method> + <method name="region_set_layers" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="region" type="RID"> + </argument> + <argument index="1" name="layers" type="int"> + </argument> + <description> + Set the region's layers. This allows selecting regions from a path request (when using [method NavigationServer2D.map_get_path]). + </description> + </method> <method name="region_set_map" qualifiers="const"> <return type="void"> </return> |