No bounce after rigidbody collision

I am seeing a common issue: a rigidbody passing through a collider that previously worked perfectly. I’ve tried many common solutions as well, but now I’m just confused. When I saw the rigidbody triggering an OnCollisionEnter event as it passed through the collider, I pretty much gave up!

Who the f–k said breakout clones were easy? =D

I am trying to understand why this is happening, and how to solve this issue without hackery. I just want the ball to bounce, on and on and on.

Additional data:

  • The “ball” is a cube. It’s a rigidbody. All rotation is disabled. Movement on the Z axis is disabled.
  • All walls are orthogonally aligned colliders. They are as wide as the ball on the axis they will hit it on.
  • Both the ball and walls have a physics material with zero friction and a bounciness of 1. (in other words, it should bounce for infinity)
  • When the ball “escapes,” its position has always passed the wall’s position, on the axis of intended reflection. The ball’s previous position is always on the other side of the wall.

Solutions attempted:

  • I cranked Fixed Timestep down to 0.01. This just made it take longer for the issue to appear.
  • I set Maximum Allowed Timestep to 0.05
  • I used the DontGoThroughThings script on the Wiki (casts a ray using the collision extents from the previous position)
  • Rigidbody Collision Detection set to Continuous (and everything else at some point)

Solutions I’d like to avoid:

  • Making walls freaking ginormous (I need the collision to be bulletproof for objects in the actual field of play)
  • Slowing down the ball (lame)

Who’s got the juice?

Hi!
I would try making the colliders wider/thicker.

I realize this is a late response, but:

Decreasing Time.fixedDeltaTime was a solid idea. Try to increase the polygon density on your walls. I’ve seen the engine work better with more triangles. Go figure.

Looking for a general solution is honorable, but each game has specific needs. An engine like Unity is already as generalized as you will get. Fix the problem at hand. Whatever works!

That said… for a breakout game with orthogonal walls you should write your own physics and guarantee the results while getting much better CPU usage. Using Unity physics is like killing a mosquito with a cannon. Furthermore, relying on a physics engine for core gameplay is not good practice unless it is a pure physics game (e.g. Bad Piggies?). Spinning your own physics empowers your design.