Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i am trying to make the game pong ( my math is really bad and i am working on it) and trying to do the bouncing ball part.

I am trying to calculate the out going(reflecting) angel of the ball after hitting the walls or pedals (the walls are always horizontal and the pedals are always vertical)

Here is an image to demonstrate it better :

reflecting image

here is what i tried so far:

m = (y2-y1) / (x2-x1)

angle = atan(-m);

How ever this does not seem to work.

share|cite|improve this question
up vote 1 down vote accepted

For a reflecting line, $$B = A$$ For the game of pong though, the position of the paddle changes the angle.

share|cite|improve this answer
B = A ? what you mean ? – Neta Meta Jan 31 '14 at 23:54
@NetaMeta - if it hits' at $30^\circ$, it will bounce back at $180\circ - 30^\circ$. In your diagram, this means $A=B$. – nbubis Jan 31 '14 at 23:56
So basically i should do 180 minus 30 ? by peddle changes the angle you mean their movement ? or the fact that if you hit the pedal not in middle the angle changes ? – Neta Meta Jan 31 '14 at 23:59
@NetaMeta - I think both. Note that this is not a math issue, but rather how the game designers decide to make the game more interesting. – nbubis Feb 1 '14 at 0:04
well, for now I'll skip those features for now as i think those are a alot more advanced. – Neta Meta Feb 1 '14 at 0:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.