godotengine / godot

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

Invalid AABB for NavigationObstacle3D #91797

Open JekSun97 opened 2 months ago

JekSun97 commented 2 months ago

Tested versions

Godot 4.3 dev6

System information

Godot v4.3.dev6 - Windows 10.0.19045 - GLES3 (Compatibility) - Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads)

Issue description

It seems that AABB does not correctly take into account the positions of points in NavigationObstacle3D, even when drawing points, AABB is constantly shifted to random places.

bug_puk

Steps to reproduce

  1. create a NavigationObstacle3D
  2. draw the points (at this stage the problem is already observed)
  3. select NavigationObstacle3D, its aabb is out of bounds

Minimal reproduction project (MRP)

easy to check

smix8 commented 2 months ago

The issue here is that the NavigationObstacle3D uses a slightly custom version of the generic polygon 3d editor draw tool. Even with being slightly custom, the obstacle still has a lot of the generic ugliness inherited from that generic tool.

The polygon 3d plugin adds a debug AABB with a default grow of 1.0 no matter what. Then it tries to query a "get_polygon" function on the edited node that does not exist for a NavigationObstacle. Since the returned polygon is empty it just shows the default AABB grown to 1.0 and that is the box you are seeing here.

While changing the AABB rendering would be trivial I think it should be outright removed for the obstacle debug. Seeing this AABB has little actual value and just adds a lot of visual editor viewport noise.

The aabb rendering makes sense for other generic polygon draws because without additional debug visuals (that the obstacle has) you can not really see those thin lines half the time all that well.