How can I change a bounce direction?

I have a little game where a bouncing ball sometimes goes into an infinite loop of 90 degree bounces off two parallel planes.

Any idea how I can test for this and add a little randomness, maybe in OnCollisionExit()?

thanks for any pointers,
andy

Two things you could try.

  1. The surface normal of the collision is available in the collision information returned.

  2. Store the object’s normalized velocity between frames,. Use it to detect if nothing but the sign changes.

Thanks for the reply. Can you change the normal of a balls velocity on the fly? Or should you apply some force vector?

One thing you might try is setting the rigidbody’s angular drag to zero and using a physic material with a bit of friction. As the ball hits a surface at an angle, it should pick up some rotation and retain it - that in itself will often be enough to randomise the effect of the collision slightly.

@walsa3000: Can you tell me your solution? I got problem like you, but the @andeeeee 's solution is not working for me