Skip to content

Commit

Permalink
Fix Navigation3DAgent script in Using NavigationAgents (#6463)
Browse files Browse the repository at this point in the history
  • Loading branch information
agomez-aj authored Dec 7, 2022
1 parent 8d1b37f commit 0891d90
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tutorials/navigation/navigation_using_navigationagents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ This script adds basic navigation movement to a Node3D with a NavigationAgent3D

func _physics_process(delta):

movement_delta = move_speed * delta
movement_delta = movement_speed * delta
var next_path_position : Vector3 = navigation_agent.get_next_location()
var current_agent_position : Vector3 = global_transform.origin
var new_velocity : Vector3 = (next_path_position - current_agent_position).normalized() * movement_delta
Expand Down Expand Up @@ -193,9 +193,10 @@ This script adds basic navigation movement to a CharacterBody3D with a Navigatio

func _physics_process(delta):

movement_delta = movement_speed * delta
var next_path_position : Vector3 = navigation_agent.get_next_location()
var current_agent_position : Vector3 = global_transform.origin
var new_velocity : Vector3 = (next_path_position - current_agent_position).normalized() * movement_speed
var new_velocity : Vector3 = (next_path_position - current_agent_position).normalized() * movement_delta
navigation_agent.set_velocity(new_velocity)

func _on_NavigationAgent3D_velocity_computed(safe_velocity : Vector3):
Expand Down

0 comments on commit 0891d90

Please sign in to comment.