mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.16k stars 1.76k forks source link

Incorrect redrawing of oversized Tile Collision Shapes #3438

Open eishiya opened 2 years ago

eishiya commented 2 years ago

When "Show Tile Collisions Shapes" is enabled, the redraw area for the brush is based only on the tiles and does not include the collision that may stick out of the tiles. In this screenshot, I'm drawing with a 16x16 tile that has a 32x32 collision rectangle. Notice how the brush preview only shows the top left part of the collision, and how there are a bunch of trails left of the other parts of the collision rectangle where I moved my cursor around. The top left of the map contains a single correctly rendered tile+collision, I achieved this by drawing the tile, then changing the zoom to rerender the entire map. image

I am using 1.9.0, Win10 64-bit, but I imagine this is a much older issue that's got unnoticed because collisions don't normally go beyond the tile's edges.

Edit: Disabling "Show Tile Collision Shapes" after having created a bunch of these glitches doesn't clear all of them, looks like only the chunks with tiles are redrawn: image

bjorn commented 2 years ago

Yeah, this is quite an annoying issue to resolve. Essentially the margins used to calculate the area to repaint will need to take into account how far any collision shapes are extending beyond the edge of each tile. Currently, this is only handled for tile objects (in MapObjectItem::expandBoundsToCoverTileCollisionObjects), but not for tiles.