Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "Target Reached" signal on the NavigationAgent2D node does not reliably trigger when the path desired distance is set above the target desired distance #85247

Closed
peter-rocchio opened this issue Nov 22, 2023 · 2 comments · Fixed by #82561

Comments

@peter-rocchio
Copy link

Godot version

4.2-rc1

System information

Windows 11, Vulkan

Issue description

When using the NavigationAgent2D the "target reached" signal usually does not trigger if the target desired distance value is below the path desired distance. If, however, the navigation agent target position is set while the agent is within the desired distance then it will reliably trigger.

This can be simulated by either issuing a nearby move command or by setting (and thus recalculating) the target position every frame.

Steps to reproduce

  1. Implement a basic CharacterBody2D
  2. Add a NavigationAgent2D node and leave the default values
  3. Set up the CharacterBody2D to move when its NavigationAgent2D has its movement position set (based on the Using NavigationAgents documentation)
  4. Connect the on_target_reached and on_navigation_finished signals
  5. Move the character around and observe that navigation is finished before the target is reached when the target position is set beyond the target desired distance
  6. Move the character a small distance within the target desired distance; observe the target reached signal reliably triggers
  7. Set the target desired distance higher than the path desired distance (or vice versa); observe that the target reached signal more reliably triggers.

Minimal reproduction project

target-reached-test.zip

@sandygk
Copy link
Contributor

sandygk commented Nov 23, 2023

Very similar to: #82560

@smix8
Copy link
Contributor

smix8 commented Nov 23, 2023

See pr #82561 that should fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants