Open JekSun97 opened 5 months ago
The sprite is scaled, so the navigation obstacle, child to the sprite, is also being scaled!
Indeed this is because of the scene configuration, and I don't think we should change the behavior to make the obstacle ignore scaling, though we could add a warning assuming the obstacle doesn't behave as expected when scaled, though I don't think that's the case unlike with collision shapes
The sprite is scaled, so the navigation obstacle, child to the sprite, is also being scaled!
I opened the same scene in 4.2.2 and drew a polygon, no such problems
I have attached a project with this scene to test the problem
Did you draw it when scaled? Does it remain the same shape when scale changes
Did you draw it when scaled? Does it remain the same shape when scale changes
The video shows the difference between 4.2.2 and 4.3 dev6
https://github.com/godotengine/godot/assets/130399274/520040e4-252d-496f-8566-7bc13d187bb0
in 4.3 the polygon itself can't even scale
The issue is that the PR that allowed to edit the vertices with the editor did not account for the inherited Node2D transform when the obstacle is not at identity transform. The polygon editor tool with now used functions for editing does not account for "position-only" polygons because it was designed for rendering polygons with a full transform and local resource so it tries to xform with the transform that should not be used creating this wrong placement.
An obstacle has no transform like a region, it just has a position. It also is axis aligned. There is no obstacle_set_transform() function on the NavigationServer API after all. An obstacle with vertices is a "static" obstacle and really not update friendly for a lot of runtime transform changes. If it was an option the Node2D transform would be disabled for the obstacle because it makes no sense to even show it in the inspector but that is not possible.
The editor obstacle plugin might need to be replaced with its own obstacle tool same as in 3D where the polygon tool also did not work at all for obstacles (you cant even change the plane axis in the default polygon edit tool).
@smix8 Yes, there are a lot of problems with navigation in general, I haven’t really tested 3D navigation, but I also found a problem with AABB of NavigationObstacle3D itself. #91797
It seems to me that we need to replace "Recast" for finding a path in 2D with something else, or add something else as an alternative, I am a former user of Game Maker, and there, in my opinion, is the simplest and fastest path search that works for any task, Godot needs something as simple, fast as possible, and with the ability to more correctly avoid dynamic obstacles.
I managed to find out that this problem occurs starting from version 4.3 dev4, in dev3 this problem is not observed. Regression after this PR #88895 ?
The obstacle classes are marked as experimental so they're still under development and still have things to work out, but it's very helpful that people are using them and identifying issues with them!
The last linked PR changed that the debug showed a navigation obstacle shape that does not exist because the obstacle has no transform. The reason why this issue now surfaces is because the changed editor plugin for the polygon drawing can not handle a debug that does not follow normal node2D transform chains. This was previously not an issue because you could not edit the polygon, you could only redraw it entirely which also updated the obstacle vertices and debug to match it.
@smix8 I would like to know if a fix is planned before the stable version 4.3 is released?
@JekSun97 No I dont think 4.3 that is already in beta. Maybe in a patch release later but I don't know.
If you look at the related PR for the 3D obstacle you see that the fix is far from simple if done right. What makes 2D even worse is that the 2D editor currently is based on the generic AbstractPolygonEditor which is used by a lot of polygon editors in the engine. This editor can not deal with all the restrictions required by an obstacle which is also why the current implementation was already so half-broken. It basically needs to be fully replaced which takes a lot of time and I am already spread more than thin.
Tested versions
Godot 4.3 dev6, before dev4 this problem is not observed
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
When drawing a polygon for NavigationObstacle2D, the geometry collapses or becomes distorted.
https://github.com/godotengine/godot/assets/130399274/b46fe5fe-abf3-4d33-9ae6-6159349227ca
https://github.com/godotengine/godot/assets/130399274/de980d0c-3bc7-4f11-8db9-02cc97380b71
I also want to point out the second problem, in the second video, when I click on the NavigationObstacle2D node, its tools do not immediately come out.
Steps to reproduce
Draw a polygon for NavigationObstacle2D
Minimal reproduction project (MRP)
nav.zip