So I'm making pong and my one problem is getting the ball to bounce. Is there something that I can apply to the sphere to make it bounce in random directions after it hits a surface? Right now I have a rigidbody on it and I've coded it to make it bounce back an forth OnTriggerEnter, but it's just bouncing straight back and forth, without going off to the sides. If I add gravity it just drops down, which is not what I want because the players are at either sides.
asked Jul 30 '11 at 04:34 PM
The simple solution is to not use a rigidbody and handle the math yourself. Unless you're making some sort of "physics enhanced" version of pong (and the lack of gravity and need for controlled bounces implies that you're not), a rigidbody is a square peg in a round hole.
Deflection math is super simple, and you have 100% control over where the ball goes when you're performing your own calculations.
answered Jul 30 '11 at 04:47 PM