From faeb8ebd960a2c15fac5ecf0ae88c8a9e2f73c22 Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Fri, 26 May 2023 11:00:24 +0200 Subject: [PATCH] Remove agent avoidance page Removes agent avoidance page. --- tutorials/navigation/index.rst | 1 - .../navigation_using_agent_avoidance.rst | 72 ------------------- .../navigation_using_navigationagents.rst | 4 +- .../navigation_using_navigationservers.rst | 1 - 4 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 tutorials/navigation/navigation_using_agent_avoidance.rst diff --git a/tutorials/navigation/index.rst b/tutorials/navigation/index.rst index 738e9e5c1..68becd284 100644 --- a/tutorials/navigation/index.rst +++ b/tutorials/navigation/index.rst @@ -17,7 +17,6 @@ Navigation navigation_using_navigationobstacles navigation_using_navigationlinks navigation_using_navigationlayers - navigation_using_agent_avoidance navigation_debug_tools navigation_connecting_navmesh navigation_different_actor_types diff --git a/tutorials/navigation/navigation_using_agent_avoidance.rst b/tutorials/navigation/navigation_using_agent_avoidance.rst deleted file mode 100644 index a574038be..000000000 --- a/tutorials/navigation/navigation_using_agent_avoidance.rst +++ /dev/null @@ -1,72 +0,0 @@ -.. _doc_navigation_using_agent_avoidance: - -Using Agent Avoidance -===================== - -This section is about how to use agent avoidance with the NavigationServer and -documents how agent avoidance is implemented in Godot. - -For avoidance with NavigationAgents see :ref:`doc_navigation_using_navigationagents`. - -Agent avoidance helps to prevent direct collision with other agents or moving obstacles -while the agents still follow their original velocity as best as possible. - -Avoidance in Godot is implemented with the help of the RVO library (Reciprocal Velocity Obstacle). -RVO places agents on a flat RVO map and gives each agent a ``radius`` and a ``position``. -Agents with overlapping radius compute a ``safe_velocity`` from their -current ``velocity``. The ``safe_velocity`` then needs to replace the original -submitted ``velocity`` to move the actor behind the agent with custom movement code. - -.. note:: - - RVO avoidance is not involved in regular pathfinding, it is a completely separate system. - If used inappropriately, the RVO avoidance can actively harm the perceived pathfinding quality. - -Creating Avoidance Agents with Scripts --------------------------------------- - -Agents and obstacles share the same NavigationServer API functions. - -Creating agents on the NavigationServer is only required for avoidance but not for normal pathfinding. -Pathfinding is map and region navmesh based while avoidance is purely map and agent based. - -.. tabs:: - .. code-tab:: gdscript GDScript - - extends Node3D - - var new_agent_rid: RID = NavigationServer3D.agent_create() - var default_3d_map_rid: RID = get_world_3d().get_navigation_map() - - NavigationServer3D.agent_set_map(new_agent_rid, default_3d_map_rid) - NavigationServer3D.agent_set_radius(new_agent_rid, 0.5) - NavigationServer3D.agent_set_position(new_agent_rid, global_transform.origin) - -To receive safe_velocity signals for avoidance for the agent a callback needs to be registered on the NavigationServer. - -.. tabs:: - .. code-tab:: gdscript GDScript - - extends Node3D - - var agent_rid: RID = NavigationServer3D.agent_create() - NavigationServer3D.agent_set_callback(agent_rid, self.on_safe_velocity_computed) - - func on_safe_velocity_computed(safe_velocity: Vector3): - # do your avoidance movement - -After the current and new calculated velocity needs to be passed to the NavigationServer each physics frame to trigger the safe_velocity callback when the avoidance processing is finished. - -.. tabs:: - .. code-tab:: gdscript GDScript - - func _physics_process(delta): - - NavigationServer3D.agent_set_velocity(current_velocity) - NavigationServer3D.agent_set_target_velocity(new_velocity) - -.. warning:: - - If _process() is used instead of _physics_process() at a higher framerate - than physics the agent velocity should not be updated more than ones each - physics frame e.g. by tracking the Engine.get_physics_frames(). diff --git a/tutorials/navigation/navigation_using_navigationagents.rst b/tutorials/navigation/navigation_using_navigationagents.rst index 7337adabf..eeceedb4d 100644 --- a/tutorials/navigation/navigation_using_navigationagents.rst +++ b/tutorials/navigation/navigation_using_navigationagents.rst @@ -89,9 +89,7 @@ There are some common user problems and important caveats to consider when writi NavigationAgent Avoidance ------------------------- -This section explains how to use the built-in avoidance specific -to NavigationAgent nodes. For general avoidance use and more technical details -on agent avoidance system see :ref:`doc_navigation_using_agent_avoidance`. +This section explains how to use the navigation avoidance specific to NavigationAgents. In order for NavigationAgents to use the avoidance feature the ``enable_avoidance`` property must be set to ``true``. diff --git a/tutorials/navigation/navigation_using_navigationservers.rst b/tutorials/navigation/navigation_using_navigationservers.rst index 6c22ad254..c63aa15f4 100644 --- a/tutorials/navigation/navigation_using_navigationservers.rst +++ b/tutorials/navigation/navigation_using_navigationservers.rst @@ -170,7 +170,6 @@ If RVO avoidance agents are registered for avoidance callbacks the NavigationSer their ``safe_velocity`` signals just before the PhysicsServer synchronization. To learn more about NavigationAgents see :ref:`doc_navigation_using_navigationagents`. -To learn more about RVO Avoidance see :ref:`doc_navigation_using_agent_avoidance`. The simplified order of execution for NavigationAgents that use avoidance: