Scaling a tilemap breaks clipping.
thefakeplace opened this issue · comments
tfpdev commented
Steps to Reproduce
Create a tilemap and apply scaling to it.
const createTilemap = () => {
const tilemap = new TileMap({
rows: 16,
columns: 16,
tileWidth: SHEET_TILE_WIDTH,
tileHeight: SHEET_TILE_HEIGHT,
});
for (const cell of tilemap.tiles) {
const sprite = spriteSheet.getSprite(0
cell.addGraphic(sprite);
}
tilemap.scale = vec(
WORLD_TILE_WIDTH / SHEET_TILE_WIDTH,
WORLD_TILE_HEIGHT / SHEET_TILE_HEIGHT,
);
return tilemap;
};
Expected Result
Clipping works.
Actual Result
Tiles are incorrectly clipped when they leave the camera view.
Screen.Recording.2023-07-16.at.10.48.07.PM.mov
Erik Onarheim commented
@thefakeplace Thanks for the issue! Definitely a bug!
I'll take a look at this soon 👍
As a possible work around you could look at zooming the camera Camera.zoom
to get the scaling you are looking to see.
tfpdev commented
Thanks! That works for me