godotengine / godot

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

Unable to connect Navigation Regions 2d by edge proximity #84773

Closed sandygk closed 12 months ago

sandygk commented 12 months ago

Godot version

4.2 beta 3

System information

Godot v4.2.beta3 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU (NVIDIA; 31.0.15.3699) - AMD Ryzen 9 6900HS with Radeon Graphics (16 Threads)

Issue description

According to the documention we should be able to connect navigation meshes when two outside edges are close but not overlapping.

But I've been trying to do use this feature, and it never seems to connect the meshes, which leads me to believe there may be a bug in the code. Here is what I get:

image

Is it something I am doing wrong, or is this a genuine bug? I've tried, getting them very close, overlapping, no overlapping, one point in and the other out, nothing seems to work.

Steps to reproduce

Open and run the attached project

Minimal reproduction project

nav-agent-bug.zip

smix8 commented 12 months ago

The default navigation map edge_connection_margin is 1 default navigation map cell unit, which is 1 pixel for 2D and 0.25 m for 3D.

You can increase the default margin in the ProjectSettings in Navigation->2D->Default Edge Connection Margin.

sandygk commented 12 months ago

Yup, that was it, thanks!

image

isn't 1px a bit too small for the default?

smix8 commented 12 months ago

It was reduced to 1 pixel because beginners messed up their navigation map rasterization so commonly when doing lowres pixel art games. It is easier to explain from time to time that a user can increase the edge connection margin in the settings then to explain nearly every beginner why their navigation map is all messed up.

sandygk commented 12 months ago

Sounds good. We can probably close this

sandygk commented 12 months ago

Should we add a note like this to the documentation?

The default navigation map edge_connection_margin is 1 default navigation map cell unit, which is 1 pixel for 2D and 0.25 m for 3D.