Search Issue Tracker
Fixed in 2021.2.X
Fixed in 2021.1.X
Composite Collider doesn't work with PolygonCollider2D with inverted scale.
How to reproduce:
1. Open the attached project (case_1266460-CompositeColliderWindingIssue.zip)
2. Open the "SampleScene" Scene
3. Select the "Composite" GameObject.
4. Each child GameObject has a BoxCollider2D set to use the composite. One has scale (1,1,1) and the other has scale (-1,1,1). This causes opposite windings.
Expected result: The two boxes should merge together producing a single outline (no hole in the center)
Actual result: The two boxes merge together but don't produce the single output as they have a hole in the center.
The original projects GameObjects also show this but not as clear. The bad behaviour becomes one where the two shapes end up being subtracted from one another in an XOR operation rather than a UNION (OR) operation. NOTE: When checking those GameObjects they will appear to be broken still. This is because the CompositeCollider2D stores the previous calculation. To force a new calculation with the fix, you have to disable/enable the GameObject with the CompositeCollider2D on it.
When a PolygonCollider2D is added to a CompositeCollider2D and it has either its X or Y (not both) axis-sign opposite then this changes the winding of the polygon paths from anti-clockwise to anti-clockwise.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Terrain is missing the Hidden/TerrainEngine/Details/WavingDoublePass shader when AssetBundles are built in older Unity Versions
- [Android] URP Project crashes when built on a device with PowerVR Rogue GE8320 GPU
- Deselected Game View is rendered incorrectly when resizing Game View window in two Game View window setup
- [macOS] Color picker preview shows colorful pixels when cursor is dragged on the sides of the screen
- Intensity parameter ignores Culling Mask causing incorrect lightning when additional lights are disabled