浏览代码

Fix rotated tile collision not working at runtime

kobewi 1 年之前
父节点
当前提交
b63533bf3f
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      scene/2d/tile_map.cpp

+ 5 - 1
scene/2d/tile_map.cpp

@@ -3072,8 +3072,12 @@ void TileMap::_internal_update() {
 		return;
 	}
 
+	// FIXME: This should only clear polygons that are no longer going to be used, but since it's difficult to determine,
+	// the cache is never cleared at runtime to prevent invalidating used polygons.
+	if (Engine::get_singleton()->is_editor_hint()) {
+		polygon_cache.clear();
+	}
 	// Update dirty quadrants on layers.
-	polygon_cache.clear();
 	for (Ref<TileMapLayer> &layer : layers) {
 		layer->internal_update();
 	}