Page 1 of 1

Pong Collision

Posted: Wed Apr 22, 2009 2:35 pm
by thejahooli
I've nearly finished my first pong clone and only have a few more things I'd like to do with it. One of them is to make it have better collision.
Currently I'm just checking whether there is a collision and reversing the x-velocity, but I want to have it so that different things can affect what happens to the ball such as where on the paddle it hits and which direction the paddle is moving in.

I'm thinking maybe changing the yVelocity depending on how far away from the center of the paddle the ball hits and also adding a portion of the paddle's y-velocity to the balls.

But I'd appreciate some ideas from people on other ways I could do this.

Re: Pong Collision

Posted: Wed Apr 22, 2009 5:29 pm
by davidthefat
thejahooli wrote:I've nearly finished my first pong clone and only have a few more things I'd like to do with it. One of them is to make it have better collision.
Currently I'm just checking whether there is a collision and reversing the x-velocity, but I want to have it so that different things can affect what happens to the ball such as where on the paddle it hits and which direction the paddle is moving in.

I'm thinking maybe changing the yVelocity depending on how far away from the center of the paddle the ball hits and also adding a portion of the paddle's y-velocity to the balls.

But I'd appreciate some ideas from people on other ways I could do this.
Why not add a twist to it? not just bouncing off the board but also making the velocity a random number every time it collides. You see what Im thinking?

Re: Pong Collision

Posted: Wed Apr 22, 2009 6:11 pm
by MarauderIIC
IIRC, the original was "change the angle based on where on the paddle you hit" but obviously it would be better if it was "change the angle based on how fast the paddle was moving when it hit".