Search Unity

Composite Collider doesn't create perfect outlines for Tilemap (Preview 2)

Discussion in '2D Experimental Preview' started by Scorr, Oct 29, 2016.

  1. Scorr

    Scorr

    Joined:
    Jul 2, 2013
    Posts:
    46
    Hey guys, I'm using a TileMap Collider as a Composite and I ran into the problem that it's not creating one single outline for simple squared tiles. Outline and physics shape are kept as fully squared as well.





    This causes the problem that box colliders get stuck when moving along tiles (ghost vertices problem). I know about workarounds for that but I was wondering if there's something I'm doing wrong here?
     
  2. muffin1

    muffin1

    Joined:
    Sep 25, 2016
    Posts:
    8
    Could you take some screenshots of your project hierarchy or describe how you've got your project set up? Are you using an actual TileMapCollider2D or a CompositeCollider2D? And what gameobject is this attached to?

    When using the tile map feature I attach the TileMapCollider2D to the layer and this works straight away. It might have something to do with the sprite's physics outline in the sprite editor, have you looked at that?
     
  3. Scorr

    Scorr

    Joined:
    Jul 2, 2013
    Posts:
    46
    I'm just gonna post some links instead of images so it doesn't clutter up the thread.

    http://puu.sh/s5puD/2dcc8fa2bb.png
    http://puu.sh/s5pwg/32423a850a.png
    So basically I've got a bunch of tilemaps, the background ones don't have any collider while the Platform one does.

    http://puu.sh/s5pyP/b76a7cce2a.png
    I think the only thing that stands out here is the collider offset which seems to be needed when tile size is smaller than 1. Tested without offset, same collider issue occurs.

    http://puu.sh/s5pCz/debf46f8ff.png
    This is a screenshot of the sprite editor with physics shape selected, selecting outlines shows the same thing. It should be covering all edges of the tile perfectly.
     
  4. muffin1

    muffin1

    Joined:
    Sep 25, 2016
    Posts:
    8
    Try taking the composite collider and rigidbody off of the layer and put it on the tile map game object instead, then tick the Use By Composite on the layers tile map collider
     
  5. Scorr

    Scorr

    Joined:
    Jul 2, 2013
    Posts:
    46
    Gave that a go but it gives this on the tilemap collider:

    And so the compositing doesn't actually happen.

    From all the examples I've seen it should work by just putting a composite collider on the tilemap layer.
     
  6. Pilessio

    Pilessio

    Joined:
    Jan 28, 2019
    Posts:
    5
    Try increasing property "Extrusion factor" "TilemapCollider2D".

    You have to delete every ile you painted in tilemap, increase this value from 1e-05 to 1e-03 and repaint you tiles. Now composite collider will work.