Basic 2d collision detection

二次信任 提交于 2019-11-26 14:27:32

问题


Where can I go to read more about basic 2d collision detection for games or just applications that have some interactivity?

Edit: How about javascript for Canvas games?


回答1:


The most important theorem to know is the Separating Axis Theorem (SAT). Basicly, it allows you to detect collision between two convex polygons. A good reading material is here.

If your game only concerns with convex shapes, then sat.js is a decent choice.

However, if you need to work with concave shapes, you need to other algorithms. You can decompose a concave shape into several convex shapes, poly-decomp.js can do it for you.

This paper is very interesting if you want to dive deeper.



来源:https://stackoverflow.com/questions/3851520/basic-2d-collision-detection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!