- Home /
Making Pong
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.
Answer by testure · Jul 30, 2011 at 04:47 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.
Your answer
Follow this Question
Related Questions
Avoid bouncing when ground move down 1 Answer
Gravity on a rotating platform 1 Answer
How can i rotate player when player jump ? 2 Answers
jump and land quicker 2 Answers