Pong Collision

Hey, I've made a simple Pong. The collision-system ist very boring though (arrival angle = emergent angle). Can someone tell me how to realize the original way of collision, or does anybody know a good paper about that issue? I think the collision works in that way: the higher (or lower) the ball hits the paddle, the greater is the emergent angle. I'm not sure though.



greetings

Any help: http://www.idevgames.com/forum/showthread.php?t=7242 ? :slight_smile:

Hey, thank you very much. It actually worked fine but there is still a big problem I can't solve. I just had to change the axes because my paddles are located on the left and on the right. The problem now is, that the y axis (the x axis in the link above) can't become negative. So the ball is always bouncing upwards when it hits one of the paddles.



greetings

I got it to work in another way. Probably not the original pong collision, but it makes the behaviour of the ball much more interesting! If anybody is interested:


//      Collision with player pad
      if (player.hasCollision(ball, false)) {
         ballVelocity.x *= -1f;
         
         if (ball.getLocalTranslation().y < player.getLocalTranslation().y)
         {
            ballVelocity.y -= (player.getLocalTranslation().y - ball.getLocalTranslation().y) * 2;
         }
         
         if (ball.getLocalTranslation().y > player.getLocalTranslation().y)
         {
            ballVelocity.y += (ball.getLocalTranslation().y - player.getLocalTranslation().y) * 2;
         }
      }