1
$\begingroup$

I'm working on a 2d physics simulation. It's a continuous time simulation, that is, it uses swept shapes over the time-frame and geometrical/vector 'analysis' to determine most immediate time of contact. The world is then stepped forward to that point and collisions are resolved before proceeding to step the world forward to the next time of collision.

I do not use relaxation techniques or any kind of intersection resolution. The objects are moved to contact states and contact events are resolved as collisions.

I have tried a CONTACT_RANGE of 0.001f down to 0.00001f. This value determines whether objects are in contact. Lowering this value leads to less overlap states, but presumably at some point, lowering the value further will lead to the simulation missing contact events because inaccuracies will lead to the systems of bodies being stepped into the discrete or overlap state.

Now, to the problem, the simulation seems to compute the outcome of collisions between 2 bodies (circles in the case I'm looking at), correctly. But I have not correctly dealt with 3 or more bodies being in contact.

In the past, I did not deal with momentum / KE correctly, but I did constrain velocities such that multi-body systems would not intersect in the next sub-frame. But now that I have a correct solution to 2 body collision, I want to do it properly for more bodies.

I'm not sure how to proceed. I have read an interesting suggestion, that in reality, no collisions are simultaneous, and they can be dealt with one after the other. Is this true ?

Could I simply compute the resultant velocity of a body from one contact, then do the same with the next contact etc?

And would that lead to the same solution as though I computed velocity in one step, from all contacts simultaneously?

Or do I need a single function for solving the velocity from multiple contacts?

Any guidance is appreciated.

Gavin

$\endgroup$
  • $\begingroup$ "Could I simply compute the resultant velocity of a body from one contact, then do the same with the next contact etc?". That will do, as far as I know about physics. $\endgroup$ – Abhishek Verma Mar 20 '14 at 1:25
  • $\begingroup$ The solution is quite complex as your need to build a system of equations to find all the contact impulses when happening simultaneously. $\endgroup$ – ja72 Mar 20 '14 at 3:56
  • $\begingroup$ See here and here on how to model such systems. $\endgroup$ – ja72 Mar 20 '14 at 13:20
1
$\begingroup$

As your read suggestion suggested, you can approximate physical reality with "no collisions are simultaneous". The reason is that the physical world is full of indeterminacies (AKA errors) due to thermal fluctuations and many other sources. What this means is that, even if the strict mathematical solutions that you will find by assuming simultaneous collisions versus assuming random collisions (treating all collisions that your algorithm thinks are simultaneous as happening in random order) could differ, the "physical" behavior of the system will not change in any meaningful way. No human could tell the difference between the two. In conclusion, you are safe in treating the system of collisions as non-simultaneous, and the consequences will be undetectable for the human eye (including any real physicist's real world measurements)

$\endgroup$
  • $\begingroup$ Ok, that's a really great explanation. So essentially, I'm changing the problem from a difficult problem to an easily solved problem, which still has a correct solution. By simply acknowledging that there is uncertainty anyway, so I'm just imposing my own particular uncertainty that is not very noticeable anyway. Hah, it's a fascinating realization. $\endgroup$ – Gavin Williams Mar 20 '14 at 7:50
  • $\begingroup$ I have implemented this method, and it does work as expected. And it's an easy method. My only criticism is that when I think about playing pool, it seems that simultaneous collisions are not that uncommon. Many pool tricks work because of evenly split impulses. $\endgroup$ – Gavin Williams Mar 24 '14 at 10:49
  • $\begingroup$ But in that case the balls are already in contact, it is not what I meant by "simultaneous" collision. It is a more complex interaction that can be "simplified" into a "simultaneous" collision. If you are going to simulate such configurations I guess you cannot use a "non-simultaneous" approach. $\endgroup$ – user16007 Mar 24 '14 at 17:23
  • $\begingroup$ But let me think more about it. $\endgroup$ – user16007 Mar 24 '14 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.