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

TileSet: Transform rotated navigation (sub)-polygons individually. #92955

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

libklein
Copy link
Contributor

@libklein libklein commented Jun 9, 2024

Fixes #92125.

This PR fixes the get_navigation_polygon function to ensure that individual sub-polygons of a NavigationPolygon2D are preserved when generating alternate (i.e., rotated, flipped, or transposed) tiles in TileSet.

This ensures that triangulation works properly, as unifying sub-polygons to a single polygon can create non-simple polygons.

Rotated tiles without the fix:

bugged

With the fix:

fixed

@libklein libklein force-pushed the fix-navigation-polygon-draw branch from 4b9efc4 to 60678de Compare June 9, 2024 21:54
@AThousandShips AThousandShips requested a review from a team June 10, 2024 08:18
@AThousandShips AThousandShips added this to the 4.3 milestone Jun 10, 2024
Copy link
Member

@kleonc kleonc left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just some code style nitpicks.

Also please squash your commits, a single commit per PR is preferred.

scene/resources/2d/tile_set.cpp Outdated Show resolved Hide resolved
scene/resources/2d/tile_set.cpp Outdated Show resolved Hide resolved
scene/resources/2d/tile_set.cpp Outdated Show resolved Hide resolved
scene/resources/2d/tile_set.cpp Outdated Show resolved Hide resolved
The original implementation merged sub-polygons into a single polygon
when rotating. This can cause non-simple geometries downstream
algorithms cannot handle.
@libklein libklein force-pushed the fix-navigation-polygon-draw branch from a4fdeb3 to 2dc42e8 Compare June 13, 2024 21:17
@akien-mga akien-mga merged commit 6e1e6f0 into godotengine:master Jun 14, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

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.

Rotation of Tile with Navigation mesh using editor causing invalid Polygon data for the mesh
5 participants