Ported: [3.5] Fix TileMap texture offset for navigationmesh and collisionshapes - smix8

e9ca65207e
This commit is contained in:
Relintai 2022-07-28 14:38:19 +02:00
parent d95091efab
commit a166b71594

View File

@ -591,7 +591,7 @@ void RTileMap::update_dirty_quadrants() {
if (shape.is_valid()) { if (shape.is_valid()) {
if (tile_set->tile_get_tile_mode(c.id) == RTileSet::SINGLE_TILE || (shapes[j].autotile_coord.x == c.autotile_coord_x && shapes[j].autotile_coord.y == c.autotile_coord_y)) { if (tile_set->tile_get_tile_mode(c.id) == RTileSet::SINGLE_TILE || (shapes[j].autotile_coord.x == c.autotile_coord_x && shapes[j].autotile_coord.y == c.autotile_coord_y)) {
Transform2D xform; Transform2D xform;
xform.set_origin(offset.floor()); xform.set_origin(offset.floor() + tile_ofs);
Vector2 shape_ofs = shapes[j].shape_transform.get_origin(); Vector2 shape_ofs = shapes[j].shape_transform.get_origin();
@ -640,7 +640,7 @@ void RTileMap::update_dirty_quadrants() {
if (navpoly.is_valid()) { if (navpoly.is_valid()) {
Transform2D xform; Transform2D xform;
xform.set_origin(offset.floor() + q.pos); xform.set_origin(offset.floor() + q.pos + tile_ofs);
_fix_cell_transform(xform, c, npoly_ofs, s); _fix_cell_transform(xform, c, npoly_ofs, s);
RID region = Navigation2DServer::get_singleton()->region_create(); RID region = Navigation2DServer::get_singleton()->region_create();
@ -690,7 +690,7 @@ void RTileMap::update_dirty_quadrants() {
} }
} }
Transform2D navxform; Transform2D navxform;
navxform.set_origin(offset.floor()); navxform.set_origin(offset.floor() + tile_ofs);
_fix_cell_transform(navxform, c, npoly_ofs, s); _fix_cell_transform(navxform, c, npoly_ofs, s);
vs->canvas_item_set_transform(debug_navigation_item, navxform); vs->canvas_item_set_transform(debug_navigation_item, navxform);