Box2d 创建一个巨大的身体 - 将其分割?

发布于 2024-12-29 17:36:49 字数 288 浏览 0 评论 0原文

我正在创建一个空间模拟,这需要我制作行星、小型船舶和大型船舶。

我将在物理模拟中优化我的小型飞船,使其长度约为 1 m,但是,在模拟中,行星可能约为 1000m 或更大,一些最大的飞船也可能有 200m 或更大。

据我所知,box2d 不能很好地处理大于 10m 的物体......有没有办法绕过这个限制?如果这意味着保持最佳性能,我很乐意接受较大物体的较低碰撞保真度。

我在想这可能必须通过将大型物体分成多个“部分”然后用固定接头将它们绑在一起来实现?这是个好主意吗?

也许有人可以阐明这个问题?

I am creating a space simulation, and this will require that I make planets, small ships and large ships.

I will be optimizing my small ships to equal about 1 m in the physics simulation, however, planets will probably be about ~1000m or larger in the simulation, and some of the largest ships might be 200m or larger as well.

As far as I know, box2d does not play nice with objects larger then 10m in size... is there a way to skirt this limit? I would be happy to accept lower collision fidelity for the larger objects if it meant maintaining optimal performance.

I was thinking that this might have to be achieved by splitting large objects up into multiple "sections" and then tying them together with fixed joints? Is this even a good idea?

Perhaps someone could shed some light on this problem?

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

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

发布评论

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

评论(1

听闻余生 2025-01-05 17:36:49

Box2D 经过优化,可以处理尺寸范围为 0.1 - 10 的动态物体。因此,您可以将系统缩放 10:使最小的羊为 0.1,最大的羊为 20。在这种情况下,您的行星将约为 100。

我认为你必须尝试我建议的尺寸。我认为它应该运作良好。也不要让你的身体太大。玩弄它们的密度。当我将项目中的基本密度从 10 更改为 1 时,模拟质量显着提高。

使用固定关节并不是一个好主意。建议仅在被认为易碎的情况下使用它们。否则,最好使用一个主体和多个固定装置。

Box2D is optimized to work with dynamic bodies with dimensions in range: 0.1 - 10. So you can scale your system by 10: make the smallest sheep 0.1 and the largest 20. Your planets will be in this case ~100.

I think you have to try with sizes I suggested. I think it should work well. Also don't make your bodies too massive. Play with their density. When I changed basic density in my project from 10 to 1 the simulation quality increased significantly.

Using fixed joints is not good idea. They are recommend to use only if they are considered breakable. Otherwise using one body with multiple fixtures is preferable.

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