From ec3d97dda5aa0fb0f522d8800b23f66ee2d9903f Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:14:51 +0200 Subject: [PATCH] Fix TileMaps with origin offset placing NavPolygons wrong without a Navigation2D 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. --- modules/rtile_map/tile_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/rtile_map/tile_map.cpp b/modules/rtile_map/tile_map.cpp index 10d5549ab..ed4dae863 100644 --- a/modules/rtile_map/tile_map.cpp +++ b/modules/rtile_map/tile_map.cpp @@ -162,7 +162,7 @@ void RTileMap::_update_quadrant_transform() { if (navigation) { nav_rel = get_relative_transform_to_parent(navigation); } else { - nav_rel = get_transform(); + nav_rel = get_global_transform(); } } @@ -362,7 +362,7 @@ void RTileMap::update_dirty_quadrants() { if (navigation) { nav_rel = get_relative_transform_to_parent(navigation); } else { - nav_rel = get_transform(); + nav_rel = get_global_transform(); } }