2D Polygon Collision Detection

前端 未结 4 1767
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 10:36

Does anyone know a simple way to check if two polygons, especially rectangles, are colliding? I found a simple way to see if two are touching by just checking if a

4条回答
  •  囚心锁ツ
    2020-12-31 11:23

    There are several methods, the simple is just to check if there is and overlap in X or Y bounds. This however only works with rectangles aligned with the axis.

    There is bounds checking, is the corner of one object withing the bounds of coordinates of the other.

    From there collision detection gets more advanced. Checking to see if there is a line one can draw between them in any direction and such.

提交回复
热议问题