unity-game-engine

Unity Collider doesn't work for box and circle collider


I created two GameObjects.

One is box and the other one is a ball. Then I added colliders to them (BoxCollider and CircleCollider2D, respectively) to enable collision between them, but it's not working. When I hit play button, the ball just falling to eternity.

I searched on the internet and looked for possible solutions and they didn't work.

I've already made sure that:


Solution

  • The BoxCollider and CircleCollider2D interact with physics in different dimensions, box collider physics are calculated in 3D while circle collider physics are calculated in 2D. In Unity, 3D physics and 2D physics are calculated separately so collisions between 2D and 3D colliders isn't possible. You will have to replace your box collider with a BoxCollider2D or replace your circle collider with a SphereCollider. Best of luck!