mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
Add NavigationAgent.is_navigation_finished() early return to script examples to avoid in-place jitter
Adds early return to script examples for NavigationAgent path following when NavigationAgent.is_navigation_finished() is true.
This commit is contained in:
@@ -123,7 +123,7 @@ NavigationServer2D and a NavigationAgent2D for path movement.
|
||||
navigation_agent.set_target_location(movement_target)
|
||||
|
||||
func _physics_process(delta):
|
||||
if navigation_agent.is_target_reached():
|
||||
if navigation_agent.is_navigation_finished():
|
||||
return
|
||||
|
||||
var current_agent_position : Vector2 = global_transform.origin
|
||||
@@ -173,7 +173,7 @@ NavigationServer2D and a NavigationAgent2D for path movement.
|
||||
{
|
||||
base._PhysicsProcess(delta);
|
||||
|
||||
if (_navigationAgent.IsTargetReached())
|
||||
if (_navigationAgent.IsNavigationFinished())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ a NavigationAgent3D for path movement.
|
||||
navigation_agent.set_target_position(movement_target)
|
||||
|
||||
func _physics_process(delta):
|
||||
if navigation_agent.is_target_reached():
|
||||
if navigation_agent.is_navigation_finished():
|
||||
return
|
||||
|
||||
var current_agent_position : Vector3 = global_transform.origin
|
||||
@@ -180,7 +180,7 @@ a NavigationAgent3D for path movement.
|
||||
{
|
||||
base._PhysicsProcess(delta);
|
||||
|
||||
if (_navigationAgent.IsTargetReached())
|
||||
if (_navigationAgent.IsNavigationFinished())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -167,6 +167,8 @@ This script adds basic navigation movement to a Node3D with a NavigationAgent3D
|
||||
navigation_agent.set_target_position(movement_target)
|
||||
|
||||
func _physics_process(delta):
|
||||
if navigation_agent.is_navigation_finished():
|
||||
return
|
||||
|
||||
movement_delta = movement_speed * delta
|
||||
var next_path_position : Vector3 = navigation_agent.get_next_path_position()
|
||||
@@ -197,6 +199,8 @@ This script adds basic navigation movement to a CharacterBody3D with a Navigatio
|
||||
navigation_agent.set_target_position(movement_target)
|
||||
|
||||
func _physics_process(delta):
|
||||
if navigation_agent.is_navigation_finished():
|
||||
return
|
||||
|
||||
movement_delta = movement_speed * delta
|
||||
var next_path_position : Vector3 = navigation_agent.get_next_path_position()
|
||||
@@ -226,6 +230,8 @@ This script adds basic navigation movement to a RigidBody3D with a NavigationAge
|
||||
navigation_agent.set_target_position(movement_target)
|
||||
|
||||
func _physics_process(delta):
|
||||
if navigation_agent.is_navigation_finished():
|
||||
return
|
||||
|
||||
var next_path_position : Vector3 = navigation_agent.get_next_path_position()
|
||||
var current_agent_position : Vector3 = global_transform.origin
|
||||
|
||||
Reference in New Issue
Block a user