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

Fix TileMaps placing baked NavigationPolygons with wrong offset without a Navigation2D node #66262

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented Sep 22, 2022

Fixes #66235

The legacy navigation is positioning baked TileMap navpolygons relative to the current Navigation2D node assuming that it is usually one of the parent nodes.

Without the deprecated Navigation2D node the default navigation map is used. This navigation map has no relative Node2D as it is part of the world_2d. It needs to use the global_transform of the TileMap to place navregions with the correct offset in case the TileMap is moved from the origin.

…avigation2D node

The legacy navigation was positioning baked TileMap navpolygons relative to the current Navigation2D node assuming that it is usually one of the parent nodes.

Without the deprecated Navigation2D node the default navigation map of the world_2d is used. This navigation map has no relative Node2D so it needs to use the global_transform of the TileMap to place navregions with the correct offset in case the TileMap is moved from the origin.
@smix8 smix8 requested a review from a team as a code owner September 22, 2022 15:28
@KoBeWi KoBeWi added this to the 3.x milestone Sep 22, 2022
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.

I was just investigating #66235 myself and came to the same conclusion, this is a proper fix.

BTW in #64013 I just checked the code and haven't actually checked whether get_transform() made sense logically (hence no approval). But not gonna lie, I'd also assume @smix8 checked the logic properly. 😛

@kleonc kleonc modified the milestones: 3.x, 3.6 Sep 22, 2022
@kleonc kleonc added the cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release label Sep 22, 2022
@akien-mga akien-mga merged commit 2efed1e into godotengine:3.x Sep 22, 2022
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

Cherry-picked for 3.5.1.

@akien-mga akien-mga removed the cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release label Sep 22, 2022
@smix8 smix8 deleted the navigation_fix_tilemap_offset_3.x branch September 22, 2022 19:25
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.

4 participants