Skip to content

Commit

Permalink
Replace set_velocity with velocity property
Browse files Browse the repository at this point in the history
  • Loading branch information
skyace65 committed Feb 3, 2024
1 parent c42e54b commit ec3ed48
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tutorials/navigation/navigation_using_navigationagents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The ``velocity_computed`` signal of the NavigationAgent node must be connected t

.. image:: img/agent_safevelocity_signal.png

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

While avoidance is enabled on the agent the ``safe_velocity`` vector will be received with the velocity_computed signal every physics frame.
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.
Expand Down Expand Up @@ -204,7 +204,7 @@ This script adds basic navigation movement to a :ref:`Node3D <class_Node3D>` wit
var next_path_position: Vector3 = navigation_agent.get_next_path_position()
var new_velocity: Vector3 = global_position.direction_to(next_path_position) * movement_delta
if navigation_agent.avoidance_enabled:
navigation_agent.set_velocity(new_velocity)
navigation_agent.velocity = new_velocity
else:
_on_velocity_computed(new_velocity)

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

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

Expand Down

0 comments on commit ec3ed48

Please sign in to comment.