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?