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.
- [Device Simulator] When simulator window is narrow, toolbar controls deform and some become inacessible
- .NETStandard 2.1 in the editor is missing System.Memory, System.Buffers at runtime
- [Profiler] IndexOutOfRangeException thrown when using Profiler or selecting Profiler frames in Profile Analyzer
- [Profiler] Standalone Profiler keeps recording Playmode while on pause
- ParticleSystemForceField doesn't have "enabled" property