Skip to content

Commit 76b74c6

Browse files
committed
Tile culling: use tile's worldXY and w/h so maps with different tileset sizes work
1 parent a3b8a25 commit 76b74c6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

v3/src/gameobjects/tilemap/components/CullTiles.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ var CullTiles = function (layer, camera, outputArray)
3030

3131
if (tile === null || (tile.index <= 0 && tilemapLayer.skipIndexZero)) { continue; }
3232

33-
var tileX = tile.x * tileWidth - left;
34-
var tileY = tile.y * tileHeight - top;
35-
var cullW = camera.width + tileWidth;
36-
var cullH = camera.height + tileHeight;
33+
var tileX = tile.worldX - left;
34+
var tileY = tile.worldY - top;
35+
var cullW = camera.width + tile.width;
36+
var cullH = camera.height + tile.height;
3737

3838
if (tile.visible &&
3939
tileX > -tileWidth && tileY > -tileHeight &&

0 commit comments

Comments
 (0)