X Tutup
Skip to content

Fix AStars to return empty path for disabled from point#113988

Merged
akien-mga merged 1 commit intogodotengine:masterfrom
kleonc:astar_path_from_disabled_point_is_empty
Jan 1, 2026
Merged

Fix AStars to return empty path for disabled from point#113988
akien-mga merged 1 commit intogodotengine:masterfrom
kleonc:astar_path_from_disabled_point_is_empty

Conversation

@kleonc
Copy link
Member

@kleonc kleonc commented Dec 13, 2025

Fixes #113975.

#86983 changed only AStar2D::get_id_path/AStar3D::get_id_path to return an empty path if from point is disabled.

This PR makes the same for:

  • AStar2D::get_point_path
  • AStar3D::get_point_path
  • AStarGrid2D::get_id_path (API-wise for AStarGrid2D points can be "solid" instead of "disabled")
  • AStarGrid2D::get_point_path

For all AStars, I've moved the condition checking to the internal _solve method used by both get_id_path/get_point_path.

Also previously (even after #86983) e.g. AStar2D::get_id_path(from, from) for a disabled from would still return a single-point path instead of an empty path, as from == to was being checked before !from.enabled. Fixed/swapped these checks order as well.

Added relevant test case for AStar3D (AStar2D, AStarGrid2D have no tests at all).

@kleonc kleonc added this to the 4.6 milestone Dec 13, 2025
@kleonc kleonc added the bug label Dec 13, 2025
@kleonc kleonc requested a review from a team as a code owner December 13, 2025 14:44
@kleonc kleonc requested review from a team as code owners December 13, 2025 14:44
Copy link

@ellie1232 ellie1232 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in engine in 2D, Confirmed the issue exists on the current stable branch and that it behaves as expected in the PR.
Read over the commit and didn't see any obvious issues but I'm not overly familiar with the source code so I may have missed something.

@akien-mga akien-mga merged commit 37ac9d5 into godotengine:master Jan 1, 2026
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@kleonc kleonc deleted the astar_path_from_disabled_point_is_empty branch January 1, 2026 21:33
@akien-mga akien-mga changed the title Fix AStars to return empty path for disabled from point Fix AStars to return empty path for disabled from point Jan 23, 2026
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.

Astar2D get_point_path() returns a path when first point is disabled

4 participants

X Tutup