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.
- Mouse inputs cannot be inputted when searching the Shortcuts Menu by type "Shortcut"
- "Debug Assertion Failed!" error when launching Windows Dedicated Server Player with Script Debugging enabled
- [Cinematic Studio][3D HDRP] Shader warnings thrown in the Console window when creating a new project with Cinematic Studio template
- Autoplay is triggered on Audio Assets when changing Asset Bundle tags
- Inspector Asset Bundle section has no indication for Variants, AssetBundle is written without a space, and Variant dropdown menu is available without setting the Asset Bundle first