Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify NavMeshQueries3D::_query_task_build_path_corridor #100549

Conversation

kiroxas
Copy link
Contributor

@kiroxas kiroxas commented Dec 18, 2024

Add improvements discussed in this PR.

Added distance_squared instead of distance.
Moved some declarations outside the inner loop.
Collapsed the insertion cases into the same branch.

@kiroxas kiroxas requested a review from a team as a code owner December 18, 2024 08:59
@kiroxas kiroxas force-pushed the `NavMeshQueries3D_query_task_build_path_corridor`_simplification branch from acda007 to 3504b85 Compare December 18, 2024 09:02
@Chaosus Chaosus added this to the 4.4 milestone Dec 18, 2024
@smix8
Copy link
Contributor

smix8 commented Dec 29, 2024

Looks promising. Needs a rebase now that #100823 has been merged.

@kiroxas kiroxas force-pushed the `NavMeshQueries3D_query_task_build_path_corridor`_simplification branch 3 times, most recently from b3620b9 to 8513066 Compare December 29, 2024 09:29
@Repiteo Repiteo requested a review from smix8 December 30, 2024 14:31
@smix8
Copy link
Contributor

smix8 commented Jan 2, 2025

Tested this PR and sorry to report that it breaks the pathfinding or at least the current established behavior.

When the target polygon is not reachable, e.g. a region is disabled between start and target polygons, the path with this PR gets frequently stuck on the current polygon. In master it picks the polygon closest to the target that can be reached.

@kiroxas
Copy link
Contributor Author

kiroxas commented Jan 2, 2025

Tested this PR and sorry to report that it breaks the pathfinding or at least the current established behavior.

When the target polygon is not reachable, e.g. a region is disabled between start and target polygons, the path with this PR gets frequently stuck on the current polygon. In master it picks the polygon closest to the target that can be reached.

Do you have a test case you can share for this ? So I can look at what's wrong with it.

@kiroxas kiroxas force-pushed the `NavMeshQueries3D_query_task_build_path_corridor`_simplification branch from 8513066 to 13f548c Compare January 3, 2025 07:54
@kiroxas
Copy link
Contributor Author

kiroxas commented Jan 3, 2025

Tested this PR and sorry to report that it breaks the pathfinding or at least the current established behavior.

When the target polygon is not reachable, e.g. a region is disabled between start and target polygons, the path with this PR gets frequently stuck on the current polygon. In master it picks the polygon closest to the target that can be reached.

Forgot to reset some values in the branch where we cannot reach the desired end. Tested it with your test case, and I now have the same behaviour as master. Thank you for testing and catching this.

@akien-mga akien-mga merged commit 4de07f3 into godotengine:master Jan 6, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@novhack
Copy link

novhack commented Jan 7, 2025

Hi! My navigation script suddenly started outputting thousands of these errors and it seems that it might be caused by changes in this PR. This wasn't happening with Godot master build from yesterday.

E 0:00:21:0068   target_navigation.gd:31 @ _physics_process(): Heap element index is out of range.
  <C++ Error>    Index p_index = 4294967295 is out of bounds (_buffer.size() = 33).
  <C++ Source>   modules/navigation/3d/../nav_utils.h:241 @ shift()
  <Stack Trace>  target_navigation.gd:31 @ _physics_process()

The navigation itself doesn't seem to be broken though.

The navigation script in question is very basic: https://gist.github.com/novhack/495c32bb99b3e3ba44539e442935c87d

EDIT: I locally reverted this PR and all errors are gone.

@kiroxas
Copy link
Contributor Author

kiroxas commented Jan 7, 2025

Hi! My navigation script suddenly started outputting thousands of these errors and it seems that it might be caused by changes in this PR. This wasn't happening with Godot master build from yesterday.

E 0:00:21:0068   target_navigation.gd:31 @ _physics_process(): Heap element index is out of range.
  <C++ Error>    Index p_index = 4294967295 is out of bounds (_buffer.size() = 33).
  <C++ Source>   modules/navigation/3d/../nav_utils.h:241 @ shift()
  <Stack Trace>  target_navigation.gd:31 @ _physics_process()

The navigation itself doesn't seem to be broken though.

The navigation script in question is very basic: https://gist.github.com/novhack/495c32bb99b3e3ba44539e442935c87d

EDIT: I locally reverted this PR and all errors are gone.

Thank you for reporting this, and sorry for the incovenience. Looking at the code, I think I know where this is coming from. I'll draft something to fix this.

@kiroxas
Copy link
Contributor Author

kiroxas commented Jan 7, 2025

@novhack Sorry for the inconvenience, but if you could try this PR, to check if it fix the issue for you, that would be helpful.

@kiroxas kiroxas deleted the `NavMeshQueries3D_query_task_build_path_corridor`_simplification branch January 7, 2025 13:22
@novhack
Copy link

novhack commented Jan 7, 2025

No need to apologize I'm happy to help and I really appreciate your work. I'll get to it as soon as possible. :)

@novhack
Copy link

novhack commented Jan 8, 2025

Tested and your new PR seems to have solved the issue. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants