cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
8.21k stars 1.94k forks source link

Tilemap tiles has wrong display #17257

Open HikkaKun opened 4 months ago

HikkaKun commented 4 months ago

Cocos Creator version

3.7.4, 3.8+

System information

Windows 10

Issue description

If you are using Tilemap where multiple tiles is packed into a single image, the tiles has wrong display at the edges (looks like it crops 0.5px of the tile texture on each side) and tiles don't look seamless too

image

I blame these lines of code because if you are using multiple images for each tile or just one tile in the tileset - the tile has the right display

https://github.com/cocos/cocos-engine/blob/ebafbe5455f15ce0b3ae520cca6d45c6a842b75a/cocos/tiledmap/tiled-utils.ts#L103

Relevant error log output

No response

Steps to reproduce

Just any tilemap with all tiles packed on one single sprite

Minimal reproduction project

No response

qiuguohua commented 3 months ago

Can you help create a simple demo to show this problem?

HikkaKun commented 3 months ago

@qiuguohua here you go TilemapProblems.zip