基于脉冲的物理学 - 将重物堆叠在轻物上
我正在开发一个基于脉冲的物理引擎,但我对质量差异较大的物体有问题。
在每一帧,引擎都会施加脉冲来处理碰撞。在每对碰撞对象之间多次迭代施加脉冲。如果物体的质量大致相同,这种方法就很有效。
但问题是,当将重物放在轻物上时,重物会将轻物压入地面。
问题的原因是,两个物体之间施加的冲量太小,因此即使经过多次迭代,也不足以抵消重物体上的重力。
我相信有方法可以准确计算所需的脉冲,但我担心它太复杂了?因此,我主要是在寻找一些技巧来解决这个问题,但不改变引擎的工作方式。
感谢您的任何想法!
I'm developing an impulse based physics engine, but I have a problem with objects of large mass difference.
At each frame the engine applies impulses to handle collisions. The impulses are applied over a number of iterations, between each pair of colliding objects. This works well if the objects are about the same mass.
But the problem is, that when placing a heavy object, on top of a light object, the heavy object will force then light object into the ground.
The cause of the problem is, that the impulses applied between the two objects is too small, so even over a number of iterations, it will not be enough to counter the gravity on the heavy object.
I believe there are ways to accurately calculate the needed impulses, but I fear it's too complicated? So mostly I'm looking for some tricks to counter this problem, but not changing the way the engine works.
Thanks for any ideas!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
谷歌搜索“冲击传播”,基本思想是按照重力方向(通常沿着“y”轴)对接触进行排序,并且在接触解析期间冻结下部物体(为它们分配无限质量,即 invMass = 0.0f 和 invInertiaTensor 应该是零矩阵),这样它们就不会“下沉”。我还没有实现这一点,我正在与自己蹩脚的物理引擎作斗争。
Google for 'Shock propagation', the basic idea is that you sort your contacts in the direction of gravity (usually along the 'y' axis) and during contact resolution you freeze the lower bodies (assign to them infinite mass, that is, invMass = 0.0f and invInertiaTensor should be a zero matrix) so that they don't 'sink'. I haven't implemented that, i'm struggling with my own crappy physics engine.