Closed
Description
Godot version
v4.0.stable.official [92bee43]
System information
windows 10
Issue description
best explained with pictures:
precise position of target:
as you can see, when the target is on the seam between triangles that runs from one hole to another, the path gains an erroneous point at the corner of one of the holes, before doubling back to the target.
only happens at very precise target positions.
seems related to #67480. hopefully the more minimal repro can be of help.
Steps to reproduce
run repro project, enable visible navigation, and try to position the mouse as shown in the above image.
i tried printing out the mouse position when the bug was occurring and setting the target to that value, but wasn't able to reproduce the bug that way.
Activity
smix8 commentedon Mar 12, 2023
The 4th and unwanted path point is added by the path postprocessing corridorfunnel.
smix8 commentedon Mar 13, 2023
Fixed in an internal build scheduled for the pathfinding rework.
MajikalExplosions commentedon Mar 30, 2023
Hi! I'm facing this issue too; glad to see it's fixed. Is there a resource you could point to regarding the pathfinding rework? I can't seem to find any references to it, and as I'm working on a small project that uses Godot navigation, I was hoping to get an idea about how much will be changing so that I don't waste (too much) time learning a possibly obsolete API.
MajikalExplosions commentedon Mar 30, 2023
Nevermind; I think this is it? #73566
smix8 commentedon Mar 30, 2023
@MajikalExplosions It is internal and not public yet. It also consists primarily of internal changes to the NavigationServer and not changes to the user interaction with the navigation system and API. You don't need to worry about it for your project.
smix8 commentedon May 26, 2023
I mentioned before that this was fixed in an internal build, and while it was for those particular situations, it now still shows up randomly in some other rare constellations. Fixing it for one case will shift it to another as at core it is a precision issue where the dot products used in the corridorfunnel just end up with a result that is technically "correct" but that does not match with what is expected.
As mentioned before the main issue is that the corridorfunnel postprocessing is designed for a triangulated mesh, which is the case in 3D but not always in 2D. I think what will happen at some point to truly solve this is that as soon as a single agent is requesting a path using the corridorfunnel postprocessing the navigation map will make sure that all navmeshes on the map are triangulated for the user. Because doing a lot of extra calculations on each single step in the postprocessing is worse for performance than having a few extra polygon edges.
smix8 commentedon Jul 9, 2023
@JustMog @MajikalExplosions
If you are still around please try to test the linked pr #79228 to confirm if it fixes the issue.