You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/navigation/navigation_debug_tools.rst
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,22 +5,22 @@ Navigation debug tools
5
5
6
6
.. note::
7
7
8
-
The debug tools, properties and functions are only available in Godot debug builds.
8
+
The debug tools, properties and functions are only available in Godot debug builds.
9
9
Do not use any of them in code that will be part of a release build.
10
10
11
11
Enabling navigation debug
12
12
-------------------------
13
13
14
-
The navigation debug visualizations are enabled by default inside the Editor.
15
-
To visualize navigation meshes and connections at runtime too, enable the option ``Visible Navigation`` in the editor ``Debug`` menu.
14
+
The navigation debug visualizations are enabled by default inside the editor.
15
+
To visualize navigation meshes and connections at runtime too, enable the option **Visible Navigation** in the editor **Debug** menu.
16
16
17
17
.. image:: img/navigation_debug_toggle.png
18
18
19
19
In Godot debug builds the navigation debug can also be toggled through the NavigationServer singletons from scripts.
20
20
21
21
.. tabs::
22
22
.. code-tab:: gdscript GDScript
23
-
23
+
24
24
NavigationServer2D.set_debug_enabled(false)
25
25
NavigationServer3D.set_debug_enabled(true)
26
26
@@ -60,21 +60,21 @@ The connections can be made visible through geometry with ``enable_edge_connecti
60
60
Debug performance
61
61
-----------------
62
62
63
-
To measure NavigationServer performance a dedicated monitor exists that can be found within the Editor Debugger under `Debugger->Monitors->NavigationProcess`.
63
+
To measure NavigationServer performance a dedicated monitor exists that can be found within the Editor Debugger under *Debugger->Monitors->Navigation Process*.
64
64
65
65
.. image:: img/navigation_debug_performance1.webp
66
66
67
-
NavigationProcess shows how long the NavigationServer spends updating its internals this update frame in milliseconds.
68
-
NavigationProcess works similar to Process for visual frame rendering and PhysicsProcess for collision and fixed updates.
67
+
Navigation Process shows how long the NavigationServer spends updating its internals this update frame in milliseconds.
68
+
Navigation Process works similar to Process for visual frame rendering and Physics Process for collision and fixed updates.
69
69
70
-
NavigationProcess accounts for all updates to ``navigation maps``, ``navigation regions`` and ``navigation agents`` as well as all the ``avoidance calculations`` for the update frame.
70
+
Navigation Process accounts for all updates to **navigation maps**, **navigation regions** and **navigation agents** as well as all the **avoidance calculations** for the update frame.
71
71
72
72
.. note::
73
73
74
-
NavigationProcess does NOT include pathfinding performance cause pathfinding operates on the navigation map data independently from the server process update.
74
+
Navigation Process does NOT include pathfinding performance cause pathfinding operates on the navigation map data independently from the server process update.
75
75
76
-
NavigationProcess should be in general kept as low and as stable as possible for runtime performance to avoid frame rate issues.
77
-
Note that since the NavigationServer process update happens in the middle of the physics update an increase in NavigationProcess will automatically increase PhysicsProcess by the same amount.
76
+
Navigation Process should be in general kept as low and as stable as possible for runtime performance to avoid frame rate issues.
77
+
Note that since the NavigationServer process update happens in the middle of the physics update an increase in Navigation Process will automatically increase Physics Process by the same amount.
78
78
79
79
Navigation also provides more detailed statistics about the current navigation related objects and navigation map composition on the NavigationServer.
New NavigationAgent nodes will automatically join the default navigation map on the World2D/World3D.
15
+
New NavigationAgent nodes will automatically join the default navigation map on the :ref:`World2D<class_World2D>`/:ref:`World3D<class_World3D>`.
16
16
17
17
NavigationsAgent nodes are optional and not a hard requirement to use the navigation system.
18
18
Their entire functionality can be replaced with scripts and direct calls to the NavigationServer API.
@@ -39,7 +39,7 @@ NavigationAgent Pathfollowing
39
39
After a ``target_position`` has been set for the agent, the next position to follow in the path
40
40
can be retrieved with the ``get_next_path_position()`` function.
41
41
42
-
Once the next path position is received move the parent actor node of the agent
42
+
Once the next path position is received move the parent actor node of the agent
43
43
towards this path position with your own movement code.
44
44
45
45
.. note::
@@ -50,8 +50,8 @@ towards this path position with your own movement code.
50
50
NavigationAgents have their own internal logic to proceed with the current path and call for updates.
51
51
52
52
The ``get_next_path_position()`` function is responsible for updating many of the agent's internal states and properties.
53
-
The function should be repeatedly called `once` every ``physics_process`` until ``is_navigation_finished()`` tells that the path is finished.
54
-
The function should not be called after the target position or path end has been reached
53
+
The function should be repeatedly called *once* every ``physics_process`` until ``is_navigation_finished()`` tells that the path is finished.
54
+
The function should not be called after the target position or path end has been reached
55
55
as it can make the agent jitter in place due to the repeated path updates.
56
56
Always check very early in script with ``is_navigation_finished()`` if the path is already finished.
57
57
@@ -74,7 +74,7 @@ Pathfollowing common problems
74
74
There are some common user problems and important caveats to consider when writing agent movement scripts.
75
75
76
76
- The path is returned empty
77
-
If an agent queries a path before the navigation map synchronisation, e.g. in a _ready() function, the path might return empty. In this case the get_next_path_position() function will return the same position as the agent parent node and the agent will consider the path end reached. This is fixed by making a deferred call or using a callback e.g. waiting for the navigation map changed signal.
77
+
If an agent queries a path before the navigation map synchronisation, e.g. in a ``_ready()`` function, the path might return empty. In this case the ``get_next_path_position()`` function will return the same position as the agent parent node and the agent will consider the path end reached. This is fixed by making a deferred call or using a callback e.g. waiting for the navigation map changed signal.
78
78
79
79
- The agent is stuck dancing between two positions
80
80
This is usually caused by very frequent path updates every single frame, either deliberate or by accident (e.g. max path distance set too short). The pathfinding needs to find the closest position that are valid on navigation mesh. If a new path is requested every single frame the first path positions might end up switching constantly in front and behind the agent's current position, causing it to dance between the two positions.
@@ -94,7 +94,7 @@ In order for NavigationAgents to use the avoidance feature the ``enable_avoidanc
94
94
95
95
.. image:: img/agent_avoidance_enabled.png
96
96
97
-
The velocity_computed signal of the NavigationAgent node must be connected to receive the ``safe_velocity`` calculation result.
97
+
The ``velocity_computed`` signal of the NavigationAgent node must be connected to receive the safe velocity calculation result.
98
98
99
99
.. image:: img/agent_safevelocity_signal.png
100
100
@@ -132,7 +132,7 @@ NavigationObstacles can be used to add some environment constrains to the avoida
132
132
Avoidance does not affect the pathfinding. It should be seen as an additional option for constantly moving objects that cannot be (re)baked to a navigation mesh efficiently in order to move around them.
133
133
134
134
Using the NavigationAgent ``enable_avoidance`` property is the preferred option
135
-
to toggle avoidance. The following code snippets can be used to
135
+
to toggle avoidance. The following code snippets can be used to
136
136
toggle avoidance on agents, create or delete avoidance callbacks or switch avoidance modes.
137
137
138
138
.. tabs::
@@ -179,7 +179,7 @@ The following sections provides script templates for nodes commonly used with Na
179
179
Actor as Node3D
180
180
~~~~~~~~~~~~~~~
181
181
182
-
This script adds basic navigation movement to a Node3D with a NavigationAgent3D child node.
182
+
This script adds basic navigation movement to a :ref:`Node3D <class_Node3D>` with a :ref:`NavigationAgent3D<class_NavigationAgent3D>` child node.
183
183
184
184
.. tabs::
185
185
.. code-tab:: gdscript GDScript
@@ -214,7 +214,7 @@ This script adds basic navigation movement to a Node3D with a NavigationAgent3D
214
214
Actor as CharacterBody3D
215
215
~~~~~~~~~~~~~~~~~~~~~~~~
216
216
217
-
This script adds basic navigation movement to a CharacterBody3D with a NavigationAgent3D child node.
217
+
This script adds basic navigation movement to a :ref:`CharacterBody3D <class_CharacterBody3D>` with a :ref:`NavigationAgent3D<class_NavigationAgent3D>` child node.
218
218
219
219
.. tabs::
220
220
.. code-tab:: gdscript GDScript
@@ -248,7 +248,7 @@ This script adds basic navigation movement to a CharacterBody3D with a Navigatio
248
248
Actor as RigidBody3D
249
249
~~~~~~~~~~~~~~~~~~~~
250
250
251
-
This script adds basic navigation movement to a RigidBody3D with a NavigationAgent3D child node.
251
+
This script adds basic navigation movement to a :ref:`RigidBody3D <class_RigidBody3D>` with a :ref:`NavigationAgent3D<class_NavigationAgent3D>` child node.
Copy file name to clipboardExpand all lines: tutorials/navigation/navigation_using_navigationlayers.rst
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Using NavigationLayers
6
6
NavigationLayers are an optional feature to further control which navigation meshes are considered in a path query and which regions can be connected.
7
7
They work similar to how physics layers control collision between collision objects or how visual layers control what is rendered to the Viewport.
8
8
9
-
NavigationLayers can be named in the ``ProjectSettings`` the same as PhysicsLayers or VisualLayers.
9
+
NavigationLayers can be named in the **ProjectSettings** the same as physics layers or visual layers.
10
10
11
11
.. image:: img/navigationlayers_naming.png
12
12
@@ -15,12 +15,12 @@ If two regions have not a single compatible layer they will not be merged by the
15
15
If a region has not a single compatible navigation layer with the ``navigation_layers`` parameter of a path query this regions navigation mesh will be skipped in pathfinding.
16
16
See :ref:`doc_navigation_using_navigationpaths` for more information on querying the NavigationServer for paths.
17
17
18
-
NavigationLayers are a single ``int`` value that is used as a ``bitmask``.
18
+
NavigationLayers are a single ``int`` value that is used as a **bitmask**.
19
19
Many navigation related nodes have ``set_navigation_layer_value()`` and
20
20
``get_navigation_layer_value()`` functions to set and get a layer number directly
21
21
without the need for more complex bitwise operations.
22
22
23
-
In scripts the following helper functions can be used to work with the navigation_layers bitmask.
23
+
In scripts the following helper functions can be used to work with the ``navigation_layers`` bitmask.
24
24
25
25
.. tabs::
26
26
.. code-tab:: gdscript GDScript
@@ -64,4 +64,4 @@ trigger large scale updates on the NavigationServer.
64
64
Changing the navigation layers of NavigationAgent nodes will have an immediate
65
65
effect on the next path query. Changing the navigation layers of
66
66
regions will have an immediate effect on the region but any new region
67
-
connect or disconnect will only be in effect after the next physics_frame.
67
+
connect or disconnect will only be in effect after the next physics frame.
Different NavigationRegions can connect their navigation meshes without the need for a NavigationLink
18
+
Different NavigationRegions can connect their navigation meshes without the need for a NavigationLink
19
19
as long as they are within navigation map ``edge_connection_margin`` and have compatible ``navigation_layers``.
20
20
As soon as the distance becomes too large, building valid connections becomes a problem - a problem that NavigationLinks can solve.
21
21
@@ -25,17 +25,17 @@ See :ref:`doc_navigation_connecting_navmesh` to learn more about how to connect
25
25
.. image:: img/nav_link_properties.png
26
26
27
27
NavigationLinks share many properties with NavigationRegions like ``navigation_layers``.
28
-
NavigationLinks add a single connection between two positions over an arbitrary distance
28
+
NavigationLinks add a single connection between two positions over an arbitrary distance
29
29
compared to NavigationRegions that add a more local traversable area with a navigation mesh resource.
30
30
31
31
NavigationLinks have a ``start_position`` and ``end_position`` and can go in both directions when ``bidirectional`` is enabled.
32
32
When placed a navigationlink connects the navigation mesh polygons closest to its ``start_position`` and ``end_position`` within search radius for pathfinding.
33
33
34
-
The polygon search radius can be configured globally in the ProjectSettings under ``navigation/2d_or_3d/default_link_connection_radius``
35
-
or set for each navigation ``map`` individually using the ``NavigationServer.map_set_link_connection_radius()`` function.
34
+
The polygon search radius can be configured globally in the ProjectSettings under ``navigation/2d_or_3d/default_link_connection_radius``
35
+
or set for each navigation **map** individually using the ``NavigationServer.map_set_link_connection_radius()`` function.
36
36
37
37
Both ``start_position`` and ``end_position`` have debug markers in the Editor.
38
-
The visible radius of a position shows the polygon search radius.
38
+
The visible radius of a position shows the polygon search radius.
39
39
All navigation mesh polygons inside are compared and the closest is picked for the edge connection.
40
40
If no valid polygon is found within the search radius the navigation link gets disabled.
41
41
@@ -48,6 +48,6 @@ The visibility of the debug can also be controlled in the Editor 3D Viewport giz
48
48
49
49
NavigationLinks do not move agents between the two link positions by themselves.
50
50
51
-
A navigation link does not provide any automated movement through the link. Instead, when
52
-
an agent reaches the position of a link, game code needs to react (e.g. through area triggers) and provide means for the agent
51
+
A navigation link does not provide any automated movement through the link. Instead, when
52
+
an agent reaches the position of a link, game code needs to react (e.g. through area triggers) and provide means for the agent
53
53
to move through the link to end up at the links other position (e.g. through teleport or animation) to continue along the path.
Copy file name to clipboardExpand all lines: tutorials/navigation/navigation_using_navigationmaps.rst
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,9 @@ Default navigation maps
21
21
22
22
By default Godot creates a navigation map for each :ref:`World2D<class_World2D>` and :ref:`World3D<class_World3D>` of the root viewport.
23
23
24
-
The 2D default navigation ``map`` RID can be obtained with ``get_world_2d().get_navigation_map()`` from any :ref:`Node2D<class_Node2D>` inheriting Node.
24
+
The 2D default navigation map RID can be obtained with ``get_world_2d().get_navigation_map()`` from any :ref:`Node2D<class_Node2D>` inheriting Node.
25
25
26
-
The 3D default navigation ``map`` RID can be obtained with ``get_world_3d().get_navigation_map()`` from any :ref:`Node3D<class_Node3D>` inheriting Node.
26
+
The 3D default navigation map RID can be obtained with ``get_world_3d().get_navigation_map()`` from any :ref:`Node3D<class_Node3D>` inheriting Node.
0 commit comments