Skip to content

Commit 47ee233

Browse files
authored
Merge pull request godotengine#8886 from skyace65/VelocityChange
Replace set_velocity with velocity property
2 parents c309afb + f3364fb commit 47ee233

File tree

2 files changed

+7
-29
lines changed

2 files changed

+7
-29
lines changed

tutorials/navigation/navigation_using_navigationagents.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The ``velocity_computed`` signal of the NavigationAgent node must be connected t
9898

9999
.. image:: img/agent_safevelocity_signal.png
100100

101-
Use ``set_velocity()`` on the NavigationAgent node in ``_physics_process()`` to update the agent with the current velocity of the agent's parent node.
101+
Set the ``velocity`` of the NavigationAgent node in ``_physics_process()`` to update the agent with the current velocity of the agent's parent node.
102102

103103
While avoidance is enabled on the agent the ``safe_velocity`` vector will be received with the velocity_computed signal every physics frame.
104104
This velocity vector should be used to move the NavigationAgent's parent node in order to avoidance collision with other avoidance using agents or avoidance obstacles.
@@ -204,7 +204,7 @@ This script adds basic navigation movement to a :ref:`Node3D <class_Node3D>` wit
204204
var next_path_position: Vector3 = navigation_agent.get_next_path_position()
205205
var new_velocity: Vector3 = global_position.direction_to(next_path_position) * movement_delta
206206
if navigation_agent.avoidance_enabled:
207-
navigation_agent.set_velocity(new_velocity)
207+
navigation_agent.velocity = new_velocity
208208
else:
209209
_on_velocity_computed(new_velocity)
210210

@@ -237,7 +237,7 @@ This script adds basic navigation movement to a :ref:`CharacterBody3D <class_Cha
237237
var next_path_position: Vector3 = navigation_agent.get_next_path_position()
238238
var new_velocity: Vector3 = global_position.direction_to(next_path_position) * movement_speed
239239
if navigation_agent.avoidance_enabled:
240-
navigation_agent.set_velocity(new_velocity)
240+
navigation_agent.velocity = new_velocity
241241
else:
242242
_on_velocity_computed(new_velocity)
243243

@@ -271,7 +271,7 @@ This script adds basic navigation movement to a :ref:`RigidBody3D <class_RigidBo
271271
var next_path_position: Vector3 = navigation_agent.get_next_path_position()
272272
var new_velocity: Vector3 = global_position.direction_to(next_path_position) * movement_speed
273273
if navigation_agent.avoidance_enabled:
274-
navigation_agent.set_velocity(new_velocity)
274+
navigation_agent.velocity = new_velocity
275275
else:
276276
_on_velocity_computed(new_velocity)
277277

tutorials/navigation/navigation_using_navigationservers.rst

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,8 @@ Synchronization for the NavigationServer happens in the middle of the physics fr
4141
The important takeaway is that most NavigationServer changes take effect after the next physics frame and not immediately.
4242
This includes all changes made by navigation related nodes in the scene tree or through scripts.
4343

44-
The following functions will be executed in the synchronization phase only:
45-
46-
- ``map_set_active()``
47-
- ``map_set_up()``
48-
- ``map_set_cell_size()``
49-
- ``map_set_edge_connection_margin()``
50-
- ``region_set_map()``
51-
- ``region_set_transform()``
52-
- ``region_set_enter_cost()``
53-
- ``region_set_travel_cost()``
54-
- ``region_set_navigation_layers()``
55-
- ``region_set_navigation_mesh()``
56-
- ``agent_set_map()``
57-
- ``agent_set_neighbor_dist()``
58-
- ``agent_set_max_neighbors()``
59-
- ``agent_set_time_horizon()``
60-
- ``agent_set_radius()``
61-
- ``agent_set_max_speed()``
62-
- ``agent_set_velocity()``
63-
- ``agent_set_target_velocity()``
64-
- ``agent_set_position()``
65-
- ``agent_set_ignore_y()``
66-
- ``agent_set_callback()``
67-
- ``free()``
44+
.. note::
45+
All setters and delete functions require synchronization.
6846

6947
2D and 3D NavigationServer differences
7048
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -175,7 +153,7 @@ The simplified order of execution for NavigationAgents that use avoidance:
175153

176154
- physics frame starts.
177155
- ``_physics_process(delta)``.
178-
- ``set_velocity()`` on NavigationAgent Node.
156+
- ``velocity`` property is set on NavigationAgent Node.
179157
- Agent sends velocity and position to NavigationServer.
180158
- NavigationServer waits for synchronization.
181159
- NavigationServer synchronizes and computes avoidance velocities for all registered avoidance agents.

0 commit comments

Comments
 (0)