2d-extras icon indicating copy to clipboard operation
2d-extras copied to clipboard

Problem with Composite Colliders

Open clayrehling opened this issue 6 years ago • 22 comments

When you erase a tile, sometimes a collider gets left behind and can't be removed. Here's some screenshots:

image

I couldn't re-create the problem, but at the time I thought turning Tilemap Collider2D, “Used by composite” off and on fixed it.

clayrehling avatar Jun 05 '18 05:06 clayrehling

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.

composite collider issue

Mochnant avatar Jun 05 '18 23:06 Mochnant

We will check this out.

Also, are any custom rotations or transforms used when added Tiles to the Tilemap for these cases?

ChuanXin-Unity avatar Jun 06 '18 02:06 ChuanXin-Unity

Also, if this can be easily reproducible, could you file a Unity bug report with that project? Thanks!

ChuanXin-Unity avatar Jun 06 '18 03:06 ChuanXin-Unity

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.

composite collider issue inspector

It is easily reproducible, as all it takes is toggling the Used by Composite flag and they appear. I'll file a bug.

Mochnant avatar Jun 06 '18 03:06 Mochnant

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.

Seanba avatar Oct 23 '18 16:10 Seanba

I've not heard any updates myself.

Mochnant avatar Oct 23 '18 22:10 Mochnant

I'm also having the same issue. No update yet, also submit a report

MadCoderr avatar Feb 18 '19 14:02 MadCoderr

Same issue :( waiting for update.

maclark avatar Feb 20 '19 18:02 maclark

Any updates, @ChuanXin-Unity?

Mochnant avatar Feb 20 '19 18:02 Mochnant

Hoping to resolve this for a 2018.3 backport.

ChuanXin-Unity avatar Feb 22 '19 09:02 ChuanXin-Unity

Great news, thank you. Does that include any sort of timeline or ETA?

Mochnant avatar Feb 22 '19 15:02 Mochnant

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.

ChuanXin-Unity avatar Feb 26 '19 09:02 ChuanXin-Unity

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.

zimpzon avatar Apr 13 '19 21:04 zimpzon

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.

ChuanXin-Unity avatar Apr 23 '19 09:04 ChuanXin-Unity

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?

zimpzon avatar May 04 '19 08:05 zimpzon

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: CC

ChuanXin-Unity avatar May 09 '19 03:05 ChuanXin-Unity

The 2019.1 version will be Unity 2019.1.2f1.

ChuanXin-Unity avatar May 09 '19 10:05 ChuanXin-Unity

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 avatar Jul 01 '19 16:07 John-Okleberry

@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!

ChuanXin-Unity avatar Jul 11 '19 06:07 ChuanXin-Unity

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?

TomMetaG avatar Nov 10 '19 03:11 TomMetaG

Offset Distance parameter in Composite collider 2D to 0.05 works fine for me.

Heathro avatar Mar 21 '21 22:03 Heathro

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.

ArHiFranki avatar Jan 19 '22 07:01 ArHiFranki