NavigationAgents' is_target_reached
returns false
even within target_desired_distance
to the target_position
#82560
Labels
Milestone
Godot version
v4.1.1.stable.mono.official [bd6af8e]
System information
Godot v4.1.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 580 Series (Advanced Micro Devices, Inc.; 31.0.21902.5) - AMD Ryzen 7 2700X Eight-Core Processor (16 Threads)
Issue description
Problem
When using a NavigationAgent2D/3D, if
target_desired_distance
is belowpath_desired_distance
(which is the default for NavigationAgent2D),is_target_reached
will not becometrue
even if you are withintarget_desired_distance
distance to thetarget_position
.The documentation says nothing about that behavior.
If
target_desired_distance
is equal or abovepath_desired_distance
, the problem won't appear.Expected behavior
If the position of the parent node of a NavigationAgent2D/3D is within
target_desired_distance
totarget_position
,is_target_reached
invariably returnstrue
.Code sample
Cause of the bug
I looked at the source code and the reason for this behavior is that once the last path waypoint has been reached, the distance check that changes
is_target_reached
totrue
won't run anymore.It's an easy fix and I have a PR ready that I'll publish just after this bug report.
Steps to reproduce
Minimal reproduction project
Bug reproduction.zip
The text was updated successfully, but these errors were encountered: