From 9b86c5e6ed51d2ee59208a32217991b9a2313231 Mon Sep 17 00:00:00 2001 From: Svipal Date: Fri, 7 Feb 2020 15:31:15 +0100 Subject: [PATCH] commented --- src/tilemaps/components/CullTiles.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tilemaps/components/CullTiles.js b/src/tilemaps/components/CullTiles.js index f197a1822..d377784b3 100644 --- a/src/tilemaps/components/CullTiles.js +++ b/src/tilemaps/components/CullTiles.js @@ -71,6 +71,8 @@ var CullTiles = function (layer, camera, outputArray, renderOrder) { var cullDistances = tilemapLayer.isoCullDistances; var pos = tilemapLayer.tileToWorldXY(x,y,undefined,camera); + + // we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles. return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (- cullDistances.x - 1 / 2) && pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullDistances.x - 1 / 2) && pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (- cullDistances.y - 1 / 2)