C#C
C#3y ago
11 replies
Yawnder

✅ Unity: Issue with the Box Collider 2D and Layers.

Hi.
I need help with some collider situation I have. In words: It seems like the layer of the collider is ignored/mixed up when inheritance is involved.
In the following image, I'm trying to explain my problem:
Top left: This is my structure. The Crate sprite is attached to "Crate (2)". "Main" has a Box Collider 2D, on the layer "Player Ignored Collider" (top right image). "Smaller" has another Box Collider 2D, but is on the layer "Default" (top middle image). The "Table" (bottom right image) has a Box Collider 2D and is on the "Player Collider" layer.
Based on the collision matrix, I would expect my "Crate (2)" to fall partly through the table, but as you can see on the left image (which is the state reached once the game plays), it gets stopped by the collider on "Main" even if the matrix says it shouldn't.

Anyone can enlighten me?
image.png
Was this page helpful?