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.
- Dropdown menu covers the button when there is no space for it from below
- WebCamDevice only returns one rear-facing camera when built on Android
- Reimporting a Scripted Importer Asset when Profiler is recording will make it null
- Crash on CachedWriter::Write when building a project that has access to files being denied
- Lego tutorial does not continue when text fields are updated