- Home /
Tilemap Collider/Composite Collider leaving gaps
Hi all,
I've tried searching around for other people who've had this problem, but I couldn't find anything. I'm happy to be pointed to existing answers though.
Essentially I'm working on a 2D platformer. I have a tilemap palette based on a sprite sheet, and I've created their physics shapes in the sprite editor. I'm using this for placeholder art for my environments. This tilemap layer has a Tilemap Collider 2D attached, which uses a Composite Collider 2D which uses a Platform Effector 2D.
I didn't have any issues initially making changes or anything else. Today however, after editing the map a little bit, my tiles aren't joining together properly. The colliders still exists, but the problem is that I want my player to be able to pass through these particular objects from below and the sides. I feel that the Platform Effector 2D should make this a non issue, but my character is colliding with the tiles below these gaps as if they're normal colliders.
If you need any more information or screenshots, please ask.
Thanks!
Oh! I'm half an idiot. If my player only needs to interact with the top of the box, the sides are pointless. I can just remove them and it becomes a non-issue.
I'm still curious as to the behaviour of the Composite Collider 2D though if anyone can enlighten me.
Answer by nickculbertson · Mar 29, 2018 at 01:24 PM
I think the current solution is to add a pixel layer around each of your sprites in the sprite sheet: https://www.youtube.com/watch?v=QW53YIjhQsA
This is a good solution for graphical problems with tilemaps, so I thank you for that. I probably wasn't clear enough though that my issue is more to do with the collider. The lines I've circled in the first image are (apparently) random points where the composite collider 2d isn't joining together two tiles, creating a small platform that is bugging my player out. I can probably upload a gif of the behaviour it creates later today. Thanks for your answer, though, really :)
Have you found solution for this? I just made placeholder like you did for starter and tried out and it's doing that weird thing that character just slips through the tile even though I had collider even overlapping each other. I have no clue.
I know this topic is very old, but I found myself having the same problem. I'm working on a topdown shooter with composite colliders for walls, but every now and then my character just slips through the wall with no gaps on the colliders whatsoever. Does anyone know the fix?
Answer by Seabat10 · Apr 12, 2020 at 08:27 PM
I have found a solution, in the tilemap collider check the "Used by Composite", that fixed it to me. Anyways, to be sure that this is not going to happen again, I changed my character box collider to a capsule collider, a little jump is better than be stuck