物体之间的远见者跨度

发布于 2024-11-19 03:33:25 字数 64 浏览 3 评论 0原文

有一种情况:物体“A”落在静态物体“B”上,但是当“A”落在“B”上时,“A”和“B”之间存在跨度。如何解决问题?

There is situation: object "A" falls down on static object "B", but when "A" lands on "B" there is span between "A" and "B". How to solve the issues?

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

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

发布评论

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

评论(2

空‖城人不在 2024-11-26 03:33:25

Box2d 使用迭代求解器,模拟的质量取决于您在模拟中使用的数值。例如,在 box2d 手册中,建议将动态主体的尺寸保持在 [0.1, 10] 范围内。 0.002 的精度(来自你的评论)是一个非常好的精度。

所以有两种方法可以解决你的问题。更改您使用的测量系统或增加位置和/或速度迭代。第一种方法要好得多,因为它不会增加计算时间。

Box2d is using iterative solver and the quality of simulation depends on numerical values you use in simulation. In box2d manual is recommended to keep dynamic body's dimensions in range [0.1, 10] for example. The accuracy 0.002 (from your comment) is a very good one.

So there are two ways to solve your problem. Change the measuring system you use or increase position and/or velocity iterations. First way is much better because it will not increase the calculation time.

日裸衫吸 2024-11-26 03:33:25

Box2d 有 b2_linearSlop 参数(PhysX 中的“Skin”),

它是对几何尺寸的一点补充,以提高物理模拟的稳定性。也许它会导致您所描述的伪影。

尝试在box2d的源代码中查找以下字符串(我是从原始box2d的flash端口获取的,尽管如此,对于其他平台来说应该是相同的):

/**
* A small length used as a collision and constraint tolerance. Usually it is
* chosen to be numerically significant, but visually insignificant.
*/
static public const b2_linearSlop:Number = 0.005;   // 0.5 cm

Box2d has b2_linearSlop parameter (AKA 'Skin' in PhysX)

It's a little addition to the size of geometry to improve stability of physics simulations. Maybe it causes the artefacts described by you.

Try to look for the following strings in the source code of box2d (I've taken it from flash port of the original box2d, nonetheless it should be the same for other platforms):

/**
* A small length used as a collision and constraint tolerance. Usually it is
* chosen to be numerically significant, but visually insignificant.
*/
static public const b2_linearSlop:Number = 0.005;   // 0.5 cm
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文