Box collision detection and bouncing

后端 未结 4 1661
一生所求
一生所求 2021-01-27 14:07

I\'m making pong, and am finding it really difficult to write an algorithm that bounces the ball off the four walls properly (I will deal with scoring later on, because only par

4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-27 14:12

    A word of wisdom about using jbx's gradient method. If the ball hits near the corners of the box, while dx will be inverted, dy can place the ball above the top boundary.

提交回复
热议问题