Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Grid Cell Size 0.2 messes up composite colliders

Discussion in '2D Experimental Preview' started by Ultronator, Dec 19, 2016.

  1. Ultronator

    Ultronator

    Joined:
    May 24, 2015
    Posts:
    3
    I've been working with 20x20 pixel tiles that I've been importing as sprites at 100PPU. I wanted to try using these with the Tilemap, but it seems the Tilemap is expecting my tiles to be 100x100 in order to properly fit them to the grid. I tried setting the Grid's Cell Size to 0.2, which did fix the problem, so now the tiles fit perfectly in the grid boxes, however, this introduced some strangeness with composite collider 2d.

    Every few tiles, it creates a new collider instead of just adding to the existing composite collider. I know the Grid's Cell Size is the issue because if I import the same tileset sprites at 20PPU and use it on a Tilemap with a Grid Cell Size of 1 (the default) then it doesn't have this problem.

    Here's some pictures to illustrate this:

    Palette generated from 100PPU sprites, Cell Size: 0.2. More colliders created than expected:
    full_view.jpg

    Palette generated from 20PPU sprites, Cell Size: 1. Correct number of colliders created: 5x_full_view.jpg
     
  2. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    Think it might be a float issue or perhaps an import scale issue?
     
  3. Pilessio

    Pilessio

    Joined:
    Jan 28, 2019
    Posts:
    5
    Same problem here
     
  4. Pilessio

    Pilessio

    Joined:
    Jan 28, 2019
    Posts:
    5
    Not properly the same, My composite collider doesn't work when grid size is bigger > than 0.25
     
  5. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    @Pilessio Would it be possible to file a bug report using the Unity Bug Reporter with your project and post the issue number here? Thanks!
     
  6. Pilessio

    Pilessio

    Joined:
    Jan 28, 2019
    Posts:
    5
    Hi ChuanXin
    Resolved here increasing property "Extrusion factor" "TilemapCollider2D".

    I had to delete every tile I painted in tilemap, increase this value from 1e-05 to 1e-03 and repaint my tiles. Now composite collider will work.
     
  7. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068