godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.08k stars 21.18k forks source link

Navigation2D with point and click not working correctly in Godot 4 #36600

Closed lszl84 closed 2 years ago

lszl84 commented 4 years ago

Godot version: master (947a6636f70ea5a051efd6e470147072f2bc7f13)

OS/device including version: mac OS 10.15.2

Issue description: when using get_global_mouse_position and get_simple_path on Navigation2D, the generated path is frequently incorrect (just play around with the demo). I am aware of new navigation server in Godot 4 but I guess the backward compatibility should be supported?

This works correctly in Godot 3.2

Steps to reproduce: Just run the attached projects and click around to navigate. Nav-godot3 works correctly in Godot 3.2. Nav-godot4 exhibits incorrect behavior in Godot 4.

Minimal reproduction project: nav-godot3.zip nav-godot4.zip

EDIT

Actually, this also does not work with new NavigationAgent2D setup with set_target_location and get_next_location: godot4-navagent.zip

KoBeWi commented 3 years ago

Tried in fe93f62 Seems still valid although would be nice if someone else confirms too.

smix8 commented 2 years ago

@KoBeWi

I fixed the nav-godot4.zip MRP for Godot 4.0 and 3.5 and cannot reproduce the issue.

The NavigationServer2D returns a path where the endpoint is near pixel-perfect at the location of the global_mouse_position for every single path request. I explored the entire map making at least 100+ path requests and found no anomalies.

Maybe this issue was only valid for the old navigation implementation and can be closed now?