- Home /
Can you make a ball not hit other balls? (circle colliders)
Right now I have a simple pong game and am trying to make a power up that duplicate balls which works perfectly fine up to the point where the balls hit each other and all the physics go haywire. I want the balls to act like a breakout game where the balls can't hit each other but can still hit the paddles just fine. Is there a way to do that?
Answer by PatriceVignola · Aug 02, 2015 at 10:33 AM
What you want to do is use layers and the Physics2d (or simply Physics) matrix.
First, add a layer called "Ball" to your ball prefab:
Then, go to the Edit -> Project Settings -> Physics 2D
panel and uncheck the checkmark for the Ball/Ball case:
And you are set! What this matrix does is basically telling unity if you want collisions to happen between 2 layers or not.
Thanks it worked, didn't know you can make layers like that .
Your answer
Follow this Question
Related Questions
How to change the BoxCollider 2D Xoffset and Y offset by script ? 2 Answers
Box and circle Collider doesn't work 1 Answer
WheelCollider - I don't have a circle of Collider 1 Answer
Physics.OverlapSphere not detecting Instantiated Objects 1 Answer
ball's collider sometimes catches an edge and bounces. when ball rolls over two aligned platforms 1 Answer