如何处理多个同时发生的弹性碰撞? [英] How to handle multiple simultaneous elastic collisions?

查看:130
本文介绍了如何处理多个同时发生的弹性碰撞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基本维基百科上的方程式.但是,当存在依赖关系时,例如两个对象同时击中另一个对象:

I'm computing the result by colliding pairs of 2D convex objects (without rotation), using the basic equations on wikipedia. However, when there are dependencies, like two objects hitting another object at the same time:

就像这里,对象1和2恰好同时击中3时,成对方法失败.根据我计算碰撞的顺序(首先是1-3或首先是2-3),我将获得不同的结果.在碰撞中重复进行迭代仍会给出与顺序有关的结果.

Such as here, with objects 1 and 2 hitting 3 at the exact same time, the pair-wise approach fails. Depending on the order I compute the collisions (1-3 first or 2-3 first), I will get different results. Repeated iteration through the collisions will still give order dependent results.

我已经设置好它,所以我可以弄清楚哪些对象相互接触,因此我的代码将在计算这些对中的一个时知道对象3正在与另一个对象碰撞(因此1-3)碰撞会知道2-3碰撞,反之亦然).我也会知道哪些边缘/角与哪些接触.

I already have it setup so I can figure out what objects are in contact with each other, so my code will know when computing one of these pairs that object 3 is colliding with another object at that moment (so the 1-3 collision will know about the 2-3 collision, and vice versa). I'll know what edges/corners are in contact with what, as well.

无论哪种解决方案都需要强大的功能...例如,如果设置变得更复杂,如以下两个示例所示:

Whatever solution needs to be robust... For instance, if the setup is made more complicated like these 2 examples:

该流程必须能够处理甚至更糟.任何可能的同时接触/碰撞链.我将拥有描述它们的所有数据,因此我仅"需要知道如何解决这些系统的一般情况.我目前没有对旋转进行任​​何操作,这简化了操作.

The process needs to be able to handle that and worse. Any possible chain of simultaneous contacts/collisions. I'll have all the data on hand describing them, so I "only" need to know how to resolve the general case of these systems. I'm not doing anything with rotation currently, which simplifies things.

似乎要将对象分组在一起,但是由不正交的边所引起的干扰(请参阅最后一个带有六角形的示例)似乎会使该方法失败.

It seems like it would involve grouping objects together, but the interference caused by edges that aren't orthogonal (see that last example with a hexagon) would seem to make that approach fail.

我看到了 a之前曾问过类似的问题,但从未检查过给出的答案(死胡同?).我也不知道冲击传播将如何解决我的第一个示例,因为在第一次碰撞后C移开了……那有什么冲击要传播呢?好的,我现在看到同时发生的碰撞和震动传播是两个不同的想法,这就是为什么它似乎没有用的原因.

I saw a similar question that was asked before, but the answer given was never checked (dead end?). I'm not sure how shock propagation would resolve my first example, either, as C is moving away after the first collision... so what shock is there to propagate? edit: Ok, I see now that simultaneous collisions and shock propagation are two different ideas, that's why it didn't seem useful.

推荐答案

这种动态多接触物理的模拟引起了线性互补问题.有一些算法可以解决此类问题 ;数学与用于线性规划问题的数学有关.

This kind of dynamic simulation of multi-contact physics gives rise to a linear complementarity problem. There are algorithms available to solve this kind of problem; the math is related to that used for linear programming problems.

解决此类问题的需求比您想象的要普遍得多.任何形式的含糊逼真的模拟(即重力,地面和非弹性碰撞)很快都会导致物体相互靠在一起.准确而强大地处理从空间动态碰撞到滑动和滚动物体到块堆叠"配置的过渡,在技术上可能具有挑战性.

The need for solving this kind of problem is more common than you might think. Any kind of vaguely realistic simulation (i.e., with gravity, ground, and inelastic collisions) will soon end up with objects resting on each other; accurately and robustly handling the transition from dynamic collisions in space, to sliding and rolling objects, to "block-stacking" configurations, can be technically challenging.

我建议寻找关于该主题的书籍或其他资源.实际需要哪种技术取决于您的特定应用程序,但是您也许可以找到一些有用的库.

I recommend looking for books or other resources on the subject. Exactly which techniques you actually need will depend on your specific application, but you may be able to find some libraries that will help.

这篇关于如何处理多个同时发生的弹性碰撞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆