# Collision with supposedly aligned box-colliders

I am quite new to game development, and I am trying to create a top-down game with 2D sprites, but with a 3D feel to it. I managed to do so with the 2D engine by setting Transparency Sort Mode to Custom Axis with the axis values set to (X=0,Y=1,Z=0). I then moved the pivot of GameObjects to bottom-center and used the pivot as sorting point for the sprites. I am now trying to create the environment, but my character 'clips' against the Box Colliders, even though I did all I could think of to align them (same pivot coordinates, same collider offset and size). See the attached GIF for an example:

I think that the cause is mentioned here, but there are no solutions mentioned there. My two solutions:

• Remove the colliders, group the objects in a parent object, and add the collider there. But then I would get the same issue if I place two of those instances next to each other.
• I am still pondering to drop this approach altogether and try the same in the 3D engine, but with a fixed camera angle. I lack experience to estimate if that would be a better approach, so if someone thinks that approach would be better suited to this game style, I am happy to hear it.

Can anyone give me advice on this issue, or point me towards resources that might be useful?

Florian

Some pictures of the settings I used:

• Did you mean to use a TilemapCollider2D and/or CompositeCollider2D to merge and erase edges between tiles? – DMGregory Sep 22 '20 at 17:53
• I did try to add a CompositeCollider2D to the parent, and check 'Used by Composite' on the children's BoxCollider2D's. This did not solve the issue. Should I tweak any other settings for that to work? Also; you mention 'between tiles'. Not sure if it matters, but maybe good to add that although the floor is a TileMap in a Grid, my GameObjects are not aligned to a grid. – Florian Sep 22 '20 at 17:59
• – Florian Sep 22 '20 at 18:25

DMGregory asked me some other good questions in the comments that made me think about my problem. Based on that, I was able to solve the problem myself. In the end, I solved it by using the proposed CompositeCollider2D, and by toggling Grid Snapping on.
However, the clipping now occured at the edge of the wall. In addition, I had to set the BoxCollider2D on the Player, to a CapsuleCollider2D.