Tile Source Collision Shape larger than expected

I’ve been working on my first project with Defold, an arcade game with grid-based movement (think something like Pac-Man or Raimais) and I’m running into some oddities with the generated collision for a tile source.
image
Here I have a simple test room + player that both use 16x16 pixel tiles. And here’s how it looks with collision debugging on:
image
For some reason the collision object appears to give the tiles bounding boxes that are closer to 17x17 pixels in size, in addition to having some unexpected rounded corners. Have I set up something incorrectly or this is intended behaviour? I ask because with this current collision I have to make the player’s hitbox smaller than the graphic, otherwise when moving parallel to wall while next to it it constantly registers as collision instead of only colliding when moving into it.

Regarding the setup: my tile source is using the default settings and uses the Image as the Collision graphic. The tileset itself is the Kenney Pattern Pack Pixel and has no empty pixels inside the 16x16 tiles.

Strange. I can’t think of a reason why this is happening. Could you please open a ticket on GitHub and also attach a minimal project where the behaviour can be seen?

I wonder if it’s the collision shape that is really presented? Or maybe the debugging overlay is misleading? Did you tested some collisions already? Especially on those corners? Like placing some other box precisely in the corner or neighbouring to a tile and checking if collision is detected or not? If so then moving it one pixel from that tile and checking again?

Here’s a Github ticket for the issue. Thankfully my project is currently pretty minimal as-is so I didn’t need to strip out much of anything.

As far as I can tell from my own testing the collision is accurate to how the debug overlay is presenting. I should point out I was noticing issues with the collision before using the debugger.

2 Likes