diff options
author | Duroxxigar <young9003@gmail.com> | 2020-02-10 15:24:00 +0100 |
---|---|---|
committer | Andrea Catania <info@andreacatania.com> | 2020-02-10 15:24:06 +0100 |
commit | 383c583a0b46b36ab9b0de57d0f3f7bdecb62fc8 (patch) | |
tree | 7ece640a3f24f626446451270353080bab14ac63 | |
parent | e6be3f68da4b88cb0c7d8c7464916235c73e1f92 (diff) |
Documented the new NavigationServer and all its associated nodes (2D and 3D)
-rw-r--r-- | doc/classes/Navigation2DServer.xml | 274 | ||||
-rw-r--r-- | doc/classes/NavigationAgent.xml | 163 | ||||
-rw-r--r-- | doc/classes/NavigationAgent2D.xml | 157 | ||||
-rw-r--r-- | doc/classes/NavigationMeshInstance.xml | 23 | ||||
-rw-r--r-- | doc/classes/NavigationObstacle.xml | 29 | ||||
-rw-r--r-- | doc/classes/NavigationObstacle2D.xml | 29 | ||||
-rw-r--r-- | doc/classes/NavigationServer.xml | 323 | ||||
-rw-r--r-- | scene/3d/navigation_agent.cpp | 8 | ||||
-rw-r--r-- | scene/3d/navigation_agent.h | 4 | ||||
-rw-r--r-- | servers/navigation_2d_server.cpp | 2 | ||||
-rw-r--r-- | servers/navigation_server.cpp | 2 | ||||
-rw-r--r-- | thirdparty/README.md | 12 |
12 files changed, 1013 insertions, 13 deletions
diff --git a/doc/classes/Navigation2DServer.xml b/doc/classes/Navigation2DServer.xml new file mode 100644 index 0000000000..105d6aabf8 --- /dev/null +++ b/doc/classes/Navigation2DServer.xml @@ -0,0 +1,274 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="Navigation2DServer" inherits="Object" category="Core" version="3.2"> + <brief_description> + Server interface for low-level 2D navigation access + </brief_description> + <description> + Navigation2DServer 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. + </description> + <tutorials> + </tutorials> + <methods> + <method name="agent_create" qualifiers="const"> + <return type="RID"> + </return> + <description> + Creates the agent. + </description> + </method> + <method name="agent_is_map_changed"> + <return type="bool" qualifiers="const"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <description> + Returns true if the map got changed the previous frame. + </description> + </method> + <method name="agent_set_callback" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="receiver" type="Object"> + </argument> + <argument index="2" name="method" type="String"> + </argument> + <argument index="3" name="userdata" type="Variant" default="null"> + </argument> + <description> + Callback called at the end of the RVO process. + </description> + </method> + <method name="agent_set_map" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="map" type="RID"> + </argument> + <description> + Puts the agent in the map. + </description> + </method> + <method name="agent_set_max_neighbors" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="count" type="int"> + </argument> + <description> + Sets the maximum number of other agents the agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe. + </description> + </method> + <method name="agent_set_max_speed" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="max_speed" type="float"> + </argument> + <description> + Sets the maximum speed of the agent. Must be positive. + </description> + </method> + <method name="agent_set_neighbor_dist" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="dist" type="float"> + </argument> + <description> + Sets the maximum distance to other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe. + </description> + </method> + <method name="agent_set_position" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="position" type="Vector3"> + </argument> + <description> + Sets the position of the agent in world space. + </description> + </method> + <method name="agent_set_radius" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="radius" type="float"> + </argument> + <description> + Sets the radius of the agent. + </description> + </method> + <method name="agent_set_target_velocity" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="target_velocity" type="Vector3"> + </argument> + <description> + Sets the new target velocity. + </description> + </method> + <method name="agent_set_time_horizon" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="time" type="float"> + </argument> + <description> + The minimal amount of time for which the agent's velocities that are computed by the simulation are safe with respect to other agents. The larger this number, the sooner this agent will respond to the presence of other agents, but the less freedom this agent has in choosing its velocities. Must be positive. + </description> + </method> + <method name="agent_set_velocity" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="velocity" type="Vector3"> + </argument> + <description> + Sets the current velocity of the agent. + </description> + </method> + <method name="free" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="object" type="RID"> + </argument> + <description> + Destroy the RID + </description> + </method> + <method name="map_create" qualifiers="const"> + <return type="RID"> + </return> + <description> + Create a new map. + </description> + </method> + <method name="map_get_cell_size"> + <return type="float"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <description> + Returns the map cell size. + </description> + </method> + <method name="map_get_edge_connection_margin" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <description> + Returns the edge connection margin of the map. The edge connection margin is a distance used to connect two regions. + </description> + </method> + <method name="map_get_path" qualifiers="const"> + <return type="PoolVector2Array"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="origin" type="Vector2"> + </argument> + <argument index="2" name="destination" type="Vector2"> + </argument> + <argument index="3" name="optimize" type="bool"> + </argument> + <description> + Returns the navigation path to reach the destination from the origin, while avoiding static obstacles. + </description> + </method> + <method name="map_is_active" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <description> + Returns true if the map is active. + </description> + </method> + <method name="map_set_active" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="active" type="bool"> + </argument> + <description> + Sets the map active. + </description> + </method> + <method name="map_set_cell_size" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="cell_size" type="float"> + </argument> + <description> + Set the map cell size used to weld the navigation mesh polygons. + </description> + </method> + <method name="map_set_edge_connection_margin" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="margin" type="float"> + </argument> + <description> + Set the map edge connection margin used to weld the compatible region edges. + </description> + </method> + <method name="region_create" qualifiers="const"> + <return type="RID"> + </return> + <description> + Creates a new region. + </description> + </method> + <method name="region_set_map" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="region" type="RID"> + </argument> + <argument index="1" name="map" type="RID"> + </argument> + <description> + Sets the map for the region. + </description> + </method> + <method name="region_set_navpoly" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="region" type="RID"> + </argument> + <argument index="1" name="nav_poly" type="NavigationPolygon"> + </argument> + <description> + Sets the navigation mesh for the region. + </description> + </method> + <method name="region_set_transform" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="region" type="RID"> + </argument> + <argument index="1" name="transform" type="Transform"> + </argument> + <description> + Sets the global transformation for the region. + </description> + </method> + </methods> +</class> diff --git a/doc/classes/NavigationAgent.xml b/doc/classes/NavigationAgent.xml new file mode 100644 index 0000000000..d0e2a60fbf --- /dev/null +++ b/doc/classes/NavigationAgent.xml @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationAgent" inherits="Node" category="Core" version="3.2"> + <brief_description> + 3D Agent used in navigation for collision avoidance. + </brief_description> + <description> + 3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation] node, or using [method set_navigation]. [NavigationAgent] is physics safe. + </description> + <tutorials> + </tutorials> + <methods> + <method name="distance_to_target" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns the distance to the target location, using the agent's global position. The user must set the target location with [method set_target_location] in order for this to be accurate. + </description> + </method> + <method name="get_final_location"> + <return type="Vector3"> + </return> + <description> + Returns the reachable final location in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame. + </description> + </method> + <method name="get_nav_path" qualifiers="const"> + <return type="PoolVector3Array"> + </return> + <description> + Returns the path from start to finish in global coordinates. + </description> + </method> + <method name="get_nav_path_index" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns which index the agent is currently on in the navigation path's [PoolVector3Array]. + </description> + </method> + <method name="get_navigation" qualifiers="const"> + <return type="Node"> + </return> + <description> + Returns the [Navigation] node that the agent is using for its navigation system. + </description> + </method> + <method name="get_next_location"> + <return type="Vector3"> + </return> + <description> + Returns a [Vector3] in global coordinates, that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the origin of the agent's parent. + </description> + </method> + <method name="get_target_location" qualifiers="const"> + <return type="Vector3"> + </return> + <description> + Returns the user defined [Vector3] after setting the target location. + </description> + </method> + <method name="is_navigation_finished"> + <return type="bool"> + </return> + <description> + Returns true if the navigation path's final location has been reached. + </description> + </method> + <method name="is_target_reachable"> + <return type="bool"> + </return> + <description> + Returns true if the target location is reachable. The target location is set using [method set_target_location]. + </description> + </method> + <method name="is_target_reached" qualifiers="const"> + <return type="bool"> + </return> + <description> + Returns true if the target location is reached. The target location is set using [method set_target_location]. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location]. + </description> + </method> + <method name="set_navigation"> + <return type="void"> + </return> + <argument index="0" name="navigation" type="Node"> + </argument> + <description> + Sets the [Navigation] node used by the agent. Useful when you don't want to make the agent a child of a [Navigation] node. + </description> + </method> + <method name="set_target_location"> + <return type="void"> + </return> + <argument index="0" name="location" type="Vector3"> + </argument> + <description> + Sets the user desired final location. This will clear the current navigation path. + </description> + </method> + <method name="set_velocity"> + <return type="void"> + </return> + <argument index="0" name="velocity" type="Vector3"> + </argument> + <description> + Sends the passed in velocity to the collision avoidance algorithm. It will adjust the velocity to avoid collisions. Once the adjustment to the velocity is complete, it will emit the [signal velocity_computed] signal. + </description> + </method> + </methods> + <members> + <member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="1.0"> + The distance threshold before a target is considered to be reached. This will allow an agent to not have to hit a point on the path exactly, but in the area. + </member> + <member name="radius" type="float" setter="set_radius" getter="get_radius" default="1.0"> + The radius of the agent. + </member> + <member name="agent_height_offset" type="float" setter="set_agent_height_offset" getter="get_agent_height_offset" default="0.0"> + The agent height offset to match the navigation mesh height. + </member> + <member name="neighbor_dist" type="float" setter="set_neighbor_dist" getter="get_neighbor_dist" default="50.0"> + The distance to search for other agents. + </member> + <member name="max_neighbors" type="int" setter="set_max_neighbors" getter="get_max_neighbors" default="10"> + The maximum number of neighbors for the agent to consider. + </member> + <member name="time_horizon" type="float" setter="set_time_horizon" getter="get_time_horizon" default="5.0"> + The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithim, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. Must be positive. + </member> + <member name="max_speed" type="float" setter="set_max_speed" getter="get_max_speed" default="10.0"> + The maximum speed that an agent can move. + </member> + <member name="path_max_distance" type="float" setter="set_path_max_distance" getter="get_path_max_distance" default="3.0"> + The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceded, it recalculates the ideal path. + </member> + <member name="ignore_y" type="bool" setter="set_ignore_y" getter="get_ignore_y" default="true"> + Ignores collisions on the Y axis. Must be true to move on a horizontal plane. + </member> + </members> + <signals> + <signal name="navigation_finished"> + <description> + Notifies when the final location is reached. + </description> + </signal> + <signal name="path_changed"> + <description> + Notifies when the navigation path changes. + </description> + </signal> + <signal name="target_reached"> + <description> + Notifies when the player defined target, set with [method set_target_location], is reached. + </description> + </signal> + <signal name="velocity_computed"> + <argument index="0" name="safe_velocity" type="Vector2"> + </argument> + <description> + Notifies when the collision avoidance velocity is calculated. Emitted by [method set_velocity]. + </description> + </signal> + </signals> +</class> diff --git a/doc/classes/NavigationAgent2D.xml b/doc/classes/NavigationAgent2D.xml new file mode 100644 index 0000000000..dd3a8aa011 --- /dev/null +++ b/doc/classes/NavigationAgent2D.xml @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationAgent2D" inherits="Node" category="Core" version="3.2"> + <brief_description> + 2D Agent used in navigation for collision avoidance. + </brief_description> + <description> + 2D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation2D] node, or using [method set_navigation]. [NavigationAgent2D] is physics safe. + </description> + <tutorials> + </tutorials> + <methods> + <method name="distance_to_target" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns the distance to the target location, using the agent's global position. The user must set the target location with [method set_target_location] in order for this to be accurate. + </description> + </method> + <method name="get_final_location"> + <return type="Vector2"> + </return> + <description> + Returns the reachable final location in global coordinates. This can change if the navigation path is altered in any way. + </description> + </method> + <method name="get_nav_path" qualifiers="const"> + <return type="PoolVector2Array"> + </return> + <description> + Returns the path from start to finish in global coordinates. + </description> + </method> + <method name="get_nav_path_index" qualifiers="const"> + <return type="int"> + </return> + <description> + Returns which index the agent is currently on in the navigation path's [PoolVector2Array]. + </description> + </method> + <method name="get_navigation" qualifiers="const"> + <return type="Node"> + </return> + <description> + Returns the [Navigation2D] node that the agent is using for its navigation system. + </description> + </method> + <method name="get_next_location"> + <return type="Vector2"> + </return> + <description> + Returns a [Vector2] in global coordinates, that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. + </description> + </method> + <method name="get_target_location" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + Returns the user defined [Vector2] after setting the target location. + </description> + </method> + <method name="is_navigation_finished"> + <return type="bool"> + </return> + <description> + Returns true if the navigation path's final location has been reached. + </description> + </method> + <method name="is_target_reachable"> + <return type="bool"> + </return> + <description> + Returns true if the target location is reachable. The target location is set using [method set_target_location]. + </description> + </method> + <method name="is_target_reached" qualifiers="const"> + <return type="bool"> + </return> + <description> + Returns true if the target location is reached. The target location is set using [method set_target_location]. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location]. + </description> + </method> + <method name="set_navigation"> + <return type="void"> + </return> + <argument index="0" name="navigation" type="Node"> + </argument> + <description> + Sets the [Navigation2D] node used by the agent. Useful when you don't want to make the agent a child of a [Navigation2D] node. + </description> + </method> + <method name="set_target_location"> + <return type="void"> + </return> + <argument index="0" name="location" type="Vector2"> + </argument> + <description> + Sets the user desired final location. This will clear the current navigation path. + </description> + </method> + <method name="set_velocity"> + <return type="void"> + </return> + <argument index="0" name="velocity" type="Vector2"> + </argument> + <description> + Sends the passed in velocity to the collision avoidance algorithm. It will adjust the velocity to avoid collisions. Once the adjustment to the velocity is complete, it will emit the [signal velocity_computed] signal. + </description> + </method> + </methods> + <members> + <member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="1.0"> + The distance threshold before a target is considered to be reached. This will allow an agent to not have to hit a point on the path exactly, but in the area. + </member> + <member name="radius" type="float" setter="set_radius" getter="get_radius" default="10.0"> + The radius of the agent. + </member> + <member name="neighbor_dist" type="float" setter="set_neighbor_dist" getter="get_neighbor_dist" default="500.0"> + The distance to search for other agents. + </member> + <member name="max_neighbors" type="int" setter="set_max_neighbors" getter="get_max_neighbors" default="10"> + The maximum number of neighbors for the agent to consider. + </member> + <member name="time_horizon" type="float" setter="set_time_horizon" getter="get_time_horizon" default="20.0"> + The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithim, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. Must be positive. + </member> + <member name="max_speed" type="float" setter="set_max_speed" getter="get_max_speed" default="200.0"> + The maximum speed that an agent can move. + </member> + <member name="path_max_distance" type="float" setter="set_path_max_distance" getter="get_path_max_distance" default="3.0"> + The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceded, it recalculates the ideal path. + </member> + </members> + <signals> + <signal name="navigation_finished"> + <description> + Notifies when the final location is reached. + </description> + </signal> + <signal name="path_changed"> + <description> + Notifies when the navigation path changes. + </description> + </signal> + <signal name="target_reached"> + <description> + Notifies when the player defined target, set with [method set_target_location], is reached. + </description> + </signal> + <signal name="velocity_computed"> + <argument index="0" name="safe_velocity" type="Vector2"> + </argument> + <description> + Notifies when the collision avoidance velocity is calculated. Emitted by [method set_velocity]. + </description> + </signal> + </signals> +</class> diff --git a/doc/classes/NavigationMeshInstance.xml b/doc/classes/NavigationMeshInstance.xml index a348740fdc..75bd62e278 100644 --- a/doc/classes/NavigationMeshInstance.xml +++ b/doc/classes/NavigationMeshInstance.xml @@ -1,19 +1,42 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="NavigationMeshInstance" inherits="Spatial" version="4.0"> <brief_description> + An instance of a [NavigationMesh]. </brief_description> <description> + An instance of a [NavigationMesh]. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node. </description> <tutorials> </tutorials> <methods> + <method name="bake_navigation_mesh"> + <return type="void"> + </return> + <description> + Bakes the [NavigationMesh]. The baking is done in a seperate thread because navigation baking is not a cheap operation. This can be done at runtime. When it is completed, it automatically sets the new [NavigationMesh]. + </description> + </method> </methods> <members> <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true"> + Determines if the [NavigationMeshInstance] is enabled or disabled. </member> <member name="navmesh" type="NavigationMesh" setter="set_navigation_mesh" getter="get_navigation_mesh"> + The [NavigationMesh] resource to use. </member> </members> + <signals> + <signal name="bake_finished"> + <description> + Notifies when the navigation mesh bake operation is completed. + </description> + </signal> + <signal name="navigation_mesh_changed"> + <description> + Notifies when the [NavigationMesh] has changed. + </description> + </signal> + </signals> <constants> </constants> </class> diff --git a/doc/classes/NavigationObstacle.xml b/doc/classes/NavigationObstacle.xml new file mode 100644 index 0000000000..307538b77b --- /dev/null +++ b/doc/classes/NavigationObstacle.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationObstacle" inherits="Node" category="Core" version="3.2"> + <brief_description> + 3D Obstacle used in navigation for collision avoidance. + </brief_description> + <description> + 3D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation] node, or using [method set_navigation]. [NavigationObstacle] is physics safe. + </description> + <tutorials> + </tutorials> + <methods> + <method name="get_navigation" qualifiers="const"> + <return type="Node"> + </return> + <description> + Returns the [Navigation] node that the obstacle is using for its navigation system. + </description> + </method> + <method name="set_navigation"> + <return type="void"> + </return> + <argument index="0" name="navigation" type="Node"> + </argument> + <description> + Sets the [Navigation] node used by the obstacle. Useful when you don't want to make the obstacle a child of a [Navigation] node. + </description> + </method> + </methods> +</class> diff --git a/doc/classes/NavigationObstacle2D.xml b/doc/classes/NavigationObstacle2D.xml new file mode 100644 index 0000000000..cf5dd2fa10 --- /dev/null +++ b/doc/classes/NavigationObstacle2D.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationObstacle2D" inherits="Node" category="Core" version="3.2"> + <brief_description> + 2D Obstacle used in navigation for collision avoidance. + </brief_description> + <description> + 2D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation2D] node, or using [method set_navigation]. [NavigationObstacle] is physics safe. + </description> + <tutorials> + </tutorials> + <methods> + <method name="get_navigation" qualifiers="const"> + <return type="Node"> + </return> + <description> + Returns the [Navigation2D] node that the obstacle is using for its navigation system. + </description> + </method> + <method name="set_navigation"> + <return type="void"> + </return> + <argument index="0" name="navigation" type="Node"> + </argument> + <description> + Sets the [Navigation2D] node used by the obstacle. Useful when you don't want to make the obstacle a child of a [Navigation2D] node. + </description> + </method> + </methods> +</class> diff --git a/doc/classes/NavigationServer.xml b/doc/classes/NavigationServer.xml new file mode 100644 index 0000000000..894a46b8a7 --- /dev/null +++ b/doc/classes/NavigationServer.xml @@ -0,0 +1,323 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationServer" inherits="Object" category="Core" version="3.2"> + <brief_description> + Server interface for low-level 3D navigation access + </brief_description> + <description> + NavigationServer is the server responsible for all 3D 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. + </description> + <tutorials> + </tutorials> + <methods> + <method name="agent_create" qualifiers="const"> + <return type="RID"> + </return> + <description> + Creates the agent. + </description> + </method> + <method name="agent_is_map_changed"> + <return type="bool" qualifiers="const"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <description> + Returns true if the map got changed the previous frame. + </description> + </method> + <method name="agent_set_callback" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="receiver" type="Object"> + </argument> + <argument index="2" name="method" type="String"> + </argument> + <argument index="3" name="userdata" type="Variant" default="null"> + </argument> + <description> + Callback called at the end of the RVO process. + </description> + </method> + <method name="agent_set_map" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="map" type="RID"> + </argument> + <description> + Puts the agent in the map. + </description> + </method> + <method name="agent_set_max_neighbors" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="count" type="int"> + </argument> + <description> + Sets the maximum number of other agents the agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe. + </description> + </method> + <method name="agent_set_max_speed" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="max_speed" type="float"> + </argument> + <description> + Sets the maximum speed of the agent. Must be positive. + </description> + </method> + <method name="agent_set_neighbor_dist" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="dist" type="float"> + </argument> + <description> + Sets the maximum distance to other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe. + </description> + </method> + <method name="agent_set_position" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="position" type="Vector3"> + </argument> + <description> + Sets the position of the agent in world space. + </description> + </method> + <method name="agent_set_radius" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="radius" type="float"> + </argument> + <description> + Sets the radius of the agent. + </description> + </method> + <method name="agent_set_target_velocity" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="target_velocity" type="Vector3"> + </argument> + <description> + Sets the new target velocity. + </description> + </method> + <method name="agent_set_time_horizon" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="time" type="float"> + </argument> + <description> + The minimal amount of time for which the agent's velocities that are computed by the simulation are safe with respect to other agents. The larger this number, the sooner this agent will respond to the presence of other agents, but the less freedom this agent has in choosing its velocities. Must be positive. + </description> + </method> + <method name="agent_set_velocity" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="agent" type="RID"> + </argument> + <argument index="1" name="velocity" type="Vector3"> + </argument> + <description> + Sets the current velocity of the agent. + </description> + </method> + <method name="free" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="object" type="RID"> + </argument> + <description> + Destroy the RID + </description> + </method> + <method name="map_create" qualifiers="const"> + <return type="RID"> + </return> + <description> + Create a new map. + </description> + </method> + <method name="map_get_cell_size"> + <return type="float"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <description> + Returns the map cell size. + </description> + </method> + <method name="map_get_edge_connection_margin" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <description> + Returns the edge connection margin of the map. + </description> + </method> + <method name="map_get_path" qualifiers="const"> + <return type="PoolVector3Array"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="origin" type="Vector3"> + </argument> + <argument index="2" name="destination" type="Vector3"> + </argument> + <argument index="3" name="optimize" type="bool"> + </argument> + <description> + Returns the navigation path to reach the destination from the origin. + </description> + </method> + <method name="map_get_up" qualifiers="const"> + <return type="Vector3"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <description> + Returns the map's up direction. + </description> + </method> + <method name="map_is_active" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <description> + Returns true if the map is active. + </description> + </method> + <method name="map_set_active" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="active" type="bool"> + </argument> + <description> + Sets the map active. + </description> + </method> + <method name="map_set_cell_size" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="cell_size" type="float"> + </argument> + <description> + Set the map cell size used to weld the navigation mesh polygons. + </description> + </method> + <method name="map_set_edge_connection_margin" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="margin" type="float"> + </argument> + <description> + Set the map edge connection margein used to weld the compatible region edges. + </description> + </method> + <method name="map_set_up" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="map" type="RID"> + </argument> + <argument index="1" name="up" type="Vector3"> + </argument> + <description> + Sets the map up direction. + </description> + </method> + <method name="region_bake_navmesh" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="mesh" type="NavigationMesh"> + </argument> + <argument index="1" name="node" type="Node"> + </argument> + <description> + Bakes the navigation mesh. + </description> + </method> + <method name="region_create" qualifiers="const"> + <return type="RID"> + </return> + <description> + Creates a new region. + </description> + </method> + <method name="region_set_map" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="region" type="RID"> + </argument> + <argument index="1" name="map" type="RID"> + </argument> + <description> + Sets the map for the region. + </description> + </method> + <method name="region_set_navmesh" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="region" type="RID"> + </argument> + <argument index="1" name="nav_mesh" type="NavigationMesh"> + </argument> + <description> + Sets the navigation mesh for the region. + </description> + </method> + <method name="region_set_transform" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="region" type="RID"> + </argument> + <argument index="1" name="transform" type="Transform"> + </argument> + <description> + Sets the global transformation for the region. + </description> + </method> + <method name="set_active" qualifiers="const"> + <return type="void"> + </return> + <argument index="0" name="active" type="bool"> + </argument> + <description> + Control activation of this server. + </description> + </method> + <method name="step"> + <return type="void"> + </return> + <argument index="0" name="delta_time" type="float"> + </argument> + <description> + Steps the server. This is not threadsafe and must be called in single thread. + </description> + </method> + </methods> +</class> diff --git a/scene/3d/navigation_agent.cpp b/scene/3d/navigation_agent.cpp index 80d7aeba8f..d3f447bc24 100644 --- a/scene/3d/navigation_agent.cpp +++ b/scene/3d/navigation_agent.cpp @@ -42,8 +42,8 @@ void NavigationAgent::_bind_methods() { ClassDB::bind_method(D_METHOD("set_radius", "radius"), &NavigationAgent::set_radius); ClassDB::bind_method(D_METHOD("get_radius"), &NavigationAgent::get_radius); - ClassDB::bind_method(D_METHOD("set_player_center_height", "player_center_height"), &NavigationAgent::set_player_center_height); - ClassDB::bind_method(D_METHOD("get_player_center_height"), &NavigationAgent::get_player_center_height); + ClassDB::bind_method(D_METHOD("set_agent_height_offset", "agent_height_offset"), &NavigationAgent::set_agent_height_offset); + ClassDB::bind_method(D_METHOD("get_agent_height_offset"), &NavigationAgent::get_agent_height_offset); ClassDB::bind_method(D_METHOD("set_ignore_y", "ignore"), &NavigationAgent::set_ignore_y); ClassDB::bind_method(D_METHOD("get_ignore_y"), &NavigationAgent::get_ignore_y); @@ -82,7 +82,7 @@ void NavigationAgent::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "target_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_target_desired_distance", "get_target_desired_distance"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_radius", "get_radius"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "player_center_height", PROPERTY_HINT_RANGE, "-100.0,100,0.01"), "set_player_center_height", "get_player_center_height"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent_height_offset", PROPERTY_HINT_RANGE, "-100.0,100,0.01"), "set_agent_height_offset", "get_agent_height_offset"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "neighbor_dist", PROPERTY_HINT_RANGE, "0.1,10000,0.01"), "set_neighbor_dist", "get_neighbor_dist"); ADD_PROPERTY(PropertyInfo(Variant::INT, "max_neighbors", PROPERTY_HINT_RANGE, "1,10000,1"), "set_max_neighbors", "get_max_neighbors"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "time_horizon", PROPERTY_HINT_RANGE, "0.01,100,0.01"), "set_time_horizon", "get_time_horizon"); @@ -192,7 +192,7 @@ void NavigationAgent::set_radius(real_t p_radius) { NavigationServer::get_singleton()->agent_set_radius(agent, radius); } -void NavigationAgent::set_player_center_height(real_t p_hh) { +void NavigationAgent::set_agent_height_offset(real_t p_hh) { navigation_height_offset = p_hh; } diff --git a/scene/3d/navigation_agent.h b/scene/3d/navigation_agent.h index a0b86d6931..8f181dafe1 100644 --- a/scene/3d/navigation_agent.h +++ b/scene/3d/navigation_agent.h @@ -98,8 +98,8 @@ public: return radius; } - void set_player_center_height(real_t p_hh); - real_t get_player_center_height() const { + void set_agent_height_offset(real_t p_hh); + real_t get_agent_height_offset() const { return navigation_height_offset; } diff --git a/servers/navigation_2d_server.cpp b/servers/navigation_2d_server.cpp index 6df308d046..d4ca402136 100644 --- a/servers/navigation_2d_server.cpp +++ b/servers/navigation_2d_server.cpp @@ -146,7 +146,7 @@ void Navigation2DServer::_bind_methods() { ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &Navigation2DServer::agent_set_radius); ClassDB::bind_method(D_METHOD("agent_set_max_speed", "agent", "max_speed"), &Navigation2DServer::agent_set_max_speed); ClassDB::bind_method(D_METHOD("agent_set_velocity", "agent", "velocity"), &Navigation2DServer::agent_set_velocity); - ClassDB::bind_method(D_METHOD("agent_set_velocity_target", "agent", "target_velocity"), &Navigation2DServer::agent_set_target_velocity); + ClassDB::bind_method(D_METHOD("agent_set_target_velocity", "agent", "target_velocity"), &Navigation2DServer::agent_set_target_velocity); ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &Navigation2DServer::agent_set_position); ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &Navigation2DServer::agent_is_map_changed); ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "receiver", "method", "userdata"), &Navigation2DServer::agent_set_callback, DEFVAL(Variant())); diff --git a/servers/navigation_server.cpp b/servers/navigation_server.cpp index 91d765202c..c4c54cbce1 100644 --- a/servers/navigation_server.cpp +++ b/servers/navigation_server.cpp @@ -63,7 +63,7 @@ void NavigationServer::_bind_methods() { ClassDB::bind_method(D_METHOD("agent_set_radius", "agent", "radius"), &NavigationServer::agent_set_radius); ClassDB::bind_method(D_METHOD("agent_set_max_speed", "agent", "max_speed"), &NavigationServer::agent_set_max_speed); ClassDB::bind_method(D_METHOD("agent_set_velocity", "agent", "velocity"), &NavigationServer::agent_set_velocity); - ClassDB::bind_method(D_METHOD("agent_set_velocity_target", "agent", "target_velocity"), &NavigationServer::agent_set_target_velocity); + ClassDB::bind_method(D_METHOD("agent_set_target_velocity", "agent", "target_velocity"), &NavigationServer::agent_set_target_velocity); ClassDB::bind_method(D_METHOD("agent_set_position", "agent", "position"), &NavigationServer::agent_set_position); ClassDB::bind_method(D_METHOD("agent_is_map_changed", "agent"), &NavigationServer::agent_is_map_changed); ClassDB::bind_method(D_METHOD("agent_set_callback", "agent", "receiver", "method", "userdata"), &NavigationServer::agent_set_callback, DEFVAL(Variant())); diff --git a/thirdparty/README.md b/thirdparty/README.md index 255f0f6eb7..8143b4af56 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -432,7 +432,7 @@ Files extracted from upstream source: ## recastnavigation - Upstream: https://github.com/recastnavigation/recastnavigation -- version: git (ef3ea40f, 2017) +- Version: git (ef3ea40f, 2017) - License: zlib Files extracted from upstream source: @@ -441,19 +441,21 @@ Files extracted from upstream source: - License.txt -## Rvo2-3D +## Rvo2 - Upstream: http://gamma.cs.unc.edu/RVO2/ -- version: 1.0.1 +- Version: 3D - 1.0.1 - License: Apache 2.0 Files extracted from upstream source: - All .cpp and .h files in the `src/` folder except for RVOSimulator.cpp and RVOSimulator.h - LICENSE -- README -Important: Some files have Godot-made changes; so to enrich the features originally proposed by this library and better integrate this library with Godot. Please check the file to know what's new. +Important: Some files have Godot-made changes; so to enrich the features +originally proposed by this library and better integrate this library with +Godot. Please check the file to know what's new. + ## squish |