I created a ball bouncing between two walls, and each time it bounces gaining speed, but after a while pierces the wall.
I think because the ball goes too fast and the unity is not able to calculate the collision. (though for what I want, the ball still goes floor)
there is a way to overcome this problem?
If you’re using Unity’s physics you should be able to set a drag value on the rigidbody which will effectively cap the maximum speed. You’ll need to play around with the value until you get the effect you want.
If you’re moving things manually, you just need to cap the maximum velocity. There are multiple ways to do that but it’s hard to tell what’s best without seeing your code. One method is to use Vector3.ClampMagnitude on your velocity vector. This will clamp the vector length to a maximum value, which means velocity won’t go beyond that value.