How do I create collision detections for my bouncing balls?

后端 未结 7 1237
星月不相逢
星月不相逢 2021-02-04 18:13

I have coded an animation (in python) for three beach balls to bounce around a screen. I now wish to have them all collide and be able to bounce off each other. I would really a

7条回答
  •  -上瘾入骨i
    2021-02-04 18:49

    Detecting collisions was covered well by Pax's answer. With respect to having objects bounce off one another, I suggest checking out the following links concerning elastic collisions, inelastic collisions, and coefficients of restitution.

    EDIT: I just noticed that this was covered in another SO question, albeit not specifically for Python. You should also check there for some good links.

提交回复
热议问题