2d-extras
2d-extras copied to clipboard
Problem with Composite Colliders
When you erase a tile, sometimes a collider gets left behind and can't be removed. Here's some screenshots:
I couldn't re-create the problem, but at the time I thought turning Tilemap Collider2D, “Used by composite” off and on fixed it.
I've seem a similar problem with incorrect composite colliders, as well. When I toggle the used by composite, it leave gaps between the tiles which can cause issues.
We will check this out.
Also, are any custom rotations or transforms used when added Tiles to the Tilemap for these cases?
Also, if this can be easily reproducible, could you file a Unity bug report with that project? Thanks!
I think you're onto something, @ChuanXin-Unity!
All of the tiles that are causing issues for me in the above shot are set to Rotation Y = 180.
It is easily reproducible, as all it takes is toggling the Used by Composite flag and they appear. I'll file a bug.
Hi there. Was there ever an update or work-around on this? I'm running into issues with the CompositeCollider2D leaving behind old collision geometry too.
I've not heard any updates myself.
I'm also having the same issue. No update yet, also submit a report
Same issue :( waiting for update.
Any updates, @ChuanXin-Unity?
Hoping to resolve this for a 2018.3 backport.
Great news, thank you. Does that include any sort of timeline or ETA?
Sorry, nothing in particular. Backports to 2018.3 may take sometime due to validation. I will update the versions where the fix has landed here to keep everyone updated.
Sorry, nothing in particular. Backports to 2018.3 may take sometime due to validation. I will update the versions where the fix has landed here to keep everyone updated.
Any news about this? I tried 2019.1b and it had the same issue.
Sorry, this is taking a lot longer than expected unfortunately. This issue has been fixed though finally, and will make its way to current Unity versions.
Dare I ask for en ETA? I don't see it listed as a known issue, so I wonder if it will be listed as a fix when it is released?
Currently, the confirmed version with a system to handle these gaps would be Unity 2019.2.0a15. A 2019.1 version will be coming soon.
The Composite Collider 2D has an additional setting, Offset Distance, along with the existing Vertex distance to help deal with the gaps:
The 2019.1 version will be Unity 2019.1.2f1.
I have an issue that may be somewhat similar but I'm not totally sure. My player floats in the air on top of something in a few spots but nothing is there. I tried deleting all layers in the tilemap in that location (actually it is happening in two locations near to each other). I verified that the ground collider is not present in that place. I can also hit my head on whatever the "nothing" is if I try to jump up to it (it appears to be sloped at an angle). The only tilemap piece that appears to be similar in shape is some background mountains but I don't recall ever using them in the area of my game where the issue is happening (not to mention I deleted all layers of the tilemap in this space so that shouldn't be an issue unless residual colliders remain like you are complaining of). Also, my raycast downward (to see if I'm grounded) appears to detect nothing (using a debug.Log message as well as being unable to jump again).
@John-Okleberry Would it be possible to create a bug report using the Unity Bug Reporter when this issue occurs? This would be very helpful in order to find out what causes the issue. Thanks!
Unfortunately, this fix appears to be creating a major issue with the composite colliders. In 2019.2.11, when using a Composite Collider 2D with a Tilemap Collider 2D, I'm unable to set an offset distance of zero. This causes the Composite Collider 2D to generate uneven lines, breaking collisions in my game. Is there a way to restore the previous Composite Collider 2D behavior, which generates straight lines between points?
Offset Distance parameter in Composite collider 2D to 0.05 works fine for me.
The same issue is still in version 2021.1.28f1. Solution is set the Offset Distance in Composite Collider 2D greater or equal to 0.02. May be this parameter depends of pixel per unit of your tiles. In my case it was 31x31 pixel per unit.