Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Enter the 2020.2 Beta Sweepstakes for a chance to win an Oculus Quest 2.
    Dismiss Notice

Bug composite collider 2d doesn't really work

Discussion in '2D Experimental Preview' started by scnoobi, Aug 28, 2016.

  1. scnoobi

    scnoobi

    Joined:
    Feb 26, 2013
    Posts:
    25

    collider type: sprite(Tilemap SO)

    I think this happens because the collision itself is bigger than the grid.

    but if you have boxes bigger than the grid then they create F***ed up collision. like:


    where as when its alone its just a box.
     
  2. Johaness_Reuben

    Johaness_Reuben

    Unity Technologies

    Joined:
    Jan 27, 2016
    Posts:
    253
    Thanks. Yes, might be a bug. Did you scale the sprite after adding the CompositeCollider2D or that's the original sizes?
     
  3. scnoobi

    scnoobi

    Joined:
    Feb 26, 2013
    Posts:
    25
    thats original size
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    3,103
    The CompositeCollider2D knows nothing about tile-map or the details of the individual collider the physics geometry comes from i.e. BoxCollider2D, PolygonCollider2D or TileMapCollider2D and certainly doesn't understand or care about grid size etc. The geometry is provided by the colliders and it simply merges them.

    Just looks like some logic bug during merging, potentially related to the colliders changing and the merging going wrong. If you could create a really simple reproduction case I can get it fixed ASAP.
     
  5. scnoobi

    scnoobi

    Joined:
    Feb 26, 2013
    Posts:
    25
    easy enough. heres the sprites(from kenney's assets^^) https://drive.google.com/open?id=0B9AGLNrF2tAHY0VjR0JlMWhvdVk

    just import then into the project.
    create a pallette from them
    create the tilemap
    draw some shapes as above.
    on the layer add the components: tilemap 2d collider , composite collider.
    change tilemap2d collider to be used by composite collider and make the rigidbody static.

    you'll see all the composites are either non existant or bad
    colliders are from the scriptable object that gets created when adding the sprites to the palette(sprite)

    if my steps suck. then heres a video
     
    Last edited: Sep 1, 2016
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    3,103
    Just looks to me like the CompositeCollider2D isn't compositing at all. Try disabling/enabling the CompositeCollider2D or TileMapCollider2D component to see if that kicks it into action.

    Very strange. I'll try my own tests here.
     
  7. scnoobi

    scnoobi

    Joined:
    Feb 26, 2013
    Posts:
    25
    yeah, only composites sometimes. very odd xD
     
    Last edited: Sep 1, 2016
  8. K0ST4S

    K0ST4S

    Joined:
    Feb 2, 2017
    Posts:
    21
    Did anyone find a solution?
     
  9. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    3,103
    The post you're referring to is from 2016. There are no active bug reports for CompositeCollider2D. If you have a problem then please discuss this on your own thread or produce a bug report.

    Thanks.
     
  10. vuthang

    vuthang

    Joined:
    Mar 7, 2017
    Posts:
    8
    Composite 2d not work if game object children rotation or scale
     
  11. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    3,103
    If you have a problem, please post a new thread. I don't follow what you mean here. The composite knows nothing about hierarchy of transform changes, it composes colliders so if they exist and are attached to the same Rigidbody2D as the composite and they have their use-composite checked then they will get merged. If you find an instance where this doesn't work then please submit a bug report and send me the case number.
     
unityunity