物体之间的远见者跨度
有一种情况:物体“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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.
Box2d 有
b2_linearSlop
参数(PhysX 中的“Skin”),它是对几何尺寸的一点补充,以提高物理模拟的稳定性。也许它会导致您所描述的伪影。
尝试在box2d的源代码中查找以下字符串(我是从原始box2d的flash端口获取的,尽管如此,对于其他平台来说应该是相同的):
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):