如何模拟两根棍子的碰撞,就像你在《愤怒的小鸟》中看到的那样?
愤怒的小鸟的建筑似乎是由坚硬的棍子组成,会碰撞并倒塌。 我当然想知道该怎么做。我不介意编写原始代码,但肯定有人已经解决了这个问题并将其开源?
The angry birds buildings seem to be composed of rigid sticks that collide and fall.
I sure would like to know how to do that. I don't mind writing original code but surely someone has figured this out already and made it open source?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想看看 Box2D。这是 Erin Catto 编写的优秀的 2D 刚体动力学库。它不仅是开源的,而且还有许多非常好的 GDC 演示文稿,解释了您可以在库中找到的代码背后的理论。
You might want to have a look at Box2D. This is an excellent 2D rigid body dynamics library written by Erin Catto. Not only is it open source, there are also a number of very good GDC presentations, explaining the theory behind the code you'll find in the library.
据我所知,AngryBirds 使用 chipmunk 物理库(但我可能是错的与此)。就我个人而言,我研究了 Box2D 和chipmunk作为2D物理库,我更相信chipmunk。
这也是因为该语言绑定到 Python 和其他语言。他们只是开箱即用。 (没有双关语;))
更新:看来我错了,AngryBirds 显然正在使用 Box2D。
As far as I know, AngryBirds uses the chipmunk physics library (but I might be wrong with that). Personally I have looked into Box2D and chipmunk as 2D physics libraries and I am more convinced by chipmunk.
This is also because the language bindings to Python and other langueges. They just work out of the box. (no pun intended ;) )
Update: seems I have been wrong, AngryBirds is apparently using Box2D.