基本的2D碰撞检测 [英] Basic 2d collision detection

查看:99
本文介绍了基本的2D碰撞检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在哪里可以阅读有关游戏或仅具有某些交互性的应用程序的基本2d碰撞检测的更多信息?

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

编辑:用于Canvas游戏的javascript怎么样?

How about javascript for Canvas games?

推荐答案

最重要的定理是分离轴定理(SAT)。基本上,它使您可以检测两个多边形之间的碰撞。好的阅读材料是此处

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.

如果您的游戏只涉及凸形,那么 sat.js 是一个不错的选择。

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

但是,如果需要使用凹形,则需要其他算法。您可以将凹形分解为多个凸形, poly-decomp.js 可以为您完成。

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.

如果要深入学习,本文非常有趣。

这篇关于基本的2D碰撞检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆