[2D] Ball won't collide with wall

I try to make the playable ball collide with a wall, the problem is that doesn’t work for me even when I put the colliders and rigidbodys.

Here is the wall inspector:

Here is the player’s inspector:

Have you tried using other Collision detection modes?

Also, could you please explain what you mean by “Not colliding”? Do you mean they are passing through one another or that the messages aren’t being passed? e.g OnCollisionEnter2D

The ball just passes through the wall , yes I tried other Collision detection modes

BTW I also noticed that when my ball goes through the wall the wall moves a bit…

Lock your Wall’s positions via the inspector to stop it moving.

Are your colliders fitting your objects? Dumb question, I know, but it happens.

Well, I ‘froze’ the positions and rotations but the program wrote that it will be better to just remove the rigidbody.
Yes my collider fits, i even made the collider a bit bigger than the wall

I have replicated something simple and found no issues.

My wall stands from the side and I found that when I reduce the velocity of the ball it collides a bit and than goes through the wall, while my log shows that I collide…
I also tried raising the mass to 999 yet it still goes through.

Does the scale of the wall matter to my collision? Because I can make the wall really big but only small part of it can be seen through the camera.

Remove the Rigidbody from your wall, and let me know what happens.

Goes through… But the wall is stable now
I think the problem is that because I can control the ball, and its speed is high. The wall needs to withstand the ball’s speed and prevent it from going through

Try continuous collision detection on your ball. I have had this issue before myself with 3D objects travelling at high speeds.

Helped a bit, but not enough
At the high speeds it collides for 1 sec and than goes through, but when I reduce the speed, it partly collides. Just one half of the ball collides

If you’re going through the wall with continuous collision detection on then it means at some point you’re modifying the Transform (in some way) directly rather than letting the Rigidbody2D do that (which is why you added it right?). You also might be directly setting the Rigidbody2D.position or Rigidbody2D.rotation.

Use forces or set the velocity directly if you have to.

1 Like