Collision detection : rounded object

后端 未结 4 1861
再見小時候
再見小時候 2021-01-15 11:08

I\'m developing a Java game (but the dev. language doesn\'t really matter) including rounded objects like balls or pucks, and now working on collisions. I use a timer, so o

4条回答
  •  Happy的楠姐
    2021-01-15 12:04

    In Java, you have a java.awt.Polygon.

    The Polygon class has multiple contains methods and intersect methods.

    Defining a circle as a Polygon is a pain, depending on how accurate you want the circle to be. But once you've defined all of your objects as Polygons, you can use the defined methods to detect collisions.

提交回复
热议问题