使用 Android 物理引擎创建光滑的绳子

发布于 2024-10-20 14:22:11 字数 431 浏览 7 评论 0原文

我想用(流行的)android 物理引擎(AndEngine 和 libgdx)练习编程。

用物理对象创建一个小世界并不是很困难,但现在我想创建一根绳子并将其连接到世界中的对象。

有多种方法可以做到这一点,例如:
http://www.emanueleferonato.com/2009/10/05 /basic-box2d-rope/

但我想看到一条光滑的绳子,就像 Android 和 IOS 上的“割绳子”游戏一样。

有什么想法可以做到这一点吗?我还找不到答案,但我认为这将创建许多捆绑在一起的较小对象,但我认为这在性能方面会很糟糕?

I want to practice programming with (popular) android physics engines (AndEngine and libgdx).

It is not very difficult to create a small world with physics objects but now I want to create a rope and connect it to objects in the world.

There are several ways to do it, for example:
http://www.emanueleferonato.com/2009/10/05/basic-box2d-rope/

But I want to see a smooth rope like in "Cut The Rope" game on Android and IOS.

Are there any ideas how to do this? I can't find answer yet but I think it would be to create a number of smaller objects tied together but I think this would be bad performance-wise?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

指尖上得阳光 2024-10-27 14:22:11

我相信您创建较短的绳段并用关节连接它们的本能是正确的,是的,您最终为一段绳子创建的实体数量会对性能产生影响。

要了解它是否适​​合您的特定情况,我建议创建一根具有可变长度段的绳索,并根据性能基准做出决定,以确定通过增加段数可以使绳索变得多么光滑。

I believe your instinct to create shorter segments with joints connecting them is correct and yes, the number of bodies you end up creating for a length of rope will have an effect on the performance.

To know whether it will work for your particular situation, I would suggest creating a rope with variable length segments and make a decision based off benchmarking the performance as to how smooth you can make the rope by increasing the number of segments.

瑕疵 2024-10-27 14:22:11

在 ios 上,我们基于此示例 http://www.cocos2d-iphone.org/archives /1112 ,我们现在正在尝试将其移植到android上,但是我们的box2d版本还不支持绳索关节。

On ios we based our rope on this example, http://www.cocos2d-iphone.org/archives/1112 , we are now trying to port it to android, but our version of the box2d does not support the rope joint yet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文