Search Issue Tracker
By Design
Votes
0
Found in
2019.4
2020.3
2021.1
2021.1.14f1
2021.2
2022.1
Issue ID
1349563
Regression
No
Reversing sprite shape makes CompositeCollider2D cutout it's PolygonCollider2D's shape within a bounding BoxCollider2D
How to reproduce:
1. Open the user attached project (DevSpriteshape.zip)
2. In the SampleScene select the "Closed Sprite Shape" GameObject from the Hierarchy
3. Observe the CompositeCollider2D's lines in the scene view
Expected result: There are no collider lines except for the BoxCollider2D's
Actual result: There is a hole cut out indicated by the collider lines within the bounding BoxCollider2D
Reproducible with: 2019.4.29f1, 2020.3.14f1, 2021.1.16f1, 2021.2.0b5, 2022.1.0a3
Notes:
1. Reproducible on Ubuntu 18.04 and Windows 10
2. The sprite shape can be reversed by dragging its most bottom left point past the other two to the top right
3. The CompositeCollider2D should never use one Collider2D to cut out another. It should only merge them
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note:
So this is caused by the output winding of SpriteShape being determined by the winding order the sprite shape is drawn. Both the PolygonCollider2D and the CompositeCollider2D use opposing windings to define fill or holes. It is not correct to say that the CompositeCollider2D should only merge. If you place a CW path in the PolygonCollider2D and use in the CompositeCollider2D then it will produce a hole (by design).
The problem here is that the docs for SpriteShape need an additional note about windings and their effect on the output path for 2D colliders.