Hello everyone,
I’m experiencing an issue with my Unity 2D project where Kinematic Rigidbody2D objects do not detect collisions with Static Rigidbody2D objects, despite my setup seeming correct. Here’s a summary of the setup and the problem:
- Object Setup:
-
Dynamic Objects: I have objects named Shape that are draggable by the user. Each has:
- A Rigidbody2D set to Kinematic.
- A BoxCollider2D (IsTrigger is unchecked).
- Collision Detection is set to Continuous.
-
Static Objects: I also have static boundary objects (fSquare_Up, fSquare_Right, etc.) with:
- A Rigidbody2D set to Static.
- A BoxCollider2D with a Bouncy Material.
- No SpriteRenderer (just colliders for interaction).
2 .Collision Matrix:
- Both the Shape objects and the static boundaries are on the Default layer.
- The Collision Matrix has all Default x Default interactions enabled.
- Problem:
- The Shape objects successfully detect collisions with other objects, such as a bouncing ball, but do
not detect collisions with the static boundary objects (fSquare_#). - I’ve confirmed that the OnCollisionEnter2D method in the Shape script is being called for other
collisions (e.g., with the ball) but not for the static objects.
- Debugging Steps Taken:
- Verified that the BoxCollider2D sizes are appropriate and overlap in the scene view (Gizmos
enabled). - Ensured that all scales are (1, 1, 1) and Z positions are 0.
- Recreated the boundary objects and adjusted the BoxCollider2D size directly (without altering
Transform scale). - Tested with both static boundaries as individual objects and as children of a parent object
(Square_Perimetral).
- Error Log:
- No runtime errors occur related to physics or colliders.
Question:
What could be preventing the Shape objects from detecting collisions with the static boundaries (fSquare_#)? Are there any additional settings or debugging techniques I might have missed?
Any guidance would be greatly appreciated. Thank you in advance for your help!