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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.