Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Object Collision Programming (Multiple collision case)

I have been learning about collision in phisics programming , and i have one big doubt.

Thinking in spheres , when one sphere collision with 2 at the same time, i thought that the forces magnitude that makes the boths spheres move , must be divided by 2 . But when i'm programming it , i always see that one sphere has more speed than the second , cause the way im programming it it collision first with one that with the another . Let's show an image to draw clearly the problem:

enter image description here

At first it detect the red sphere . Then the collision is detected , and the force magnitude is like there was only one sphere. Then it detects orange sphere , and the force magnitude is less than first one.

Any idea of what must i use to programm this ,or if i'm having any missconception?

mod:

Furthermore , if you help me searching for a mechanism that makes this happen nicely i would give you 50+ more .

like image 641
A.Quiroga Avatar asked Nov 13 '22 06:11

A.Quiroga


2 Answers

The problem is that for a two body collision, conservation of energy and momentum are basically sufficient for determining the outcome, but for a three body problem this is no longer the case. Even if you do do what Mark and Daren suggest, and determine all colliding bodies within a timestep, it doesn't really get you anywhere, because 1) you still won't know how to move the objects after the collision; and 2) the primary question in how many objects to consider during each collision isn't the timestep but the deformation of the objects, and if you treat this correctly the sequence of updating within a timestep wont matter. For example, if you have very soft objects, they will probably be in contact for many timesteps, and very hard objects only a few timesteps.

A good answer to this problem is a bit tricky, and the reason for this is contained in your bonus question, that is, what's the mechanism. The mechanism is basically just the things you're not considering in your simplified problem: deformation of the objects, slip, rotation, etc, but these will generally be dominant issues in three body collision.

What you do depends entirely on how much accuracy you need. You could just pretend that all collisions are either between two objects, or a third hitting two is always exactly symmetric (which is a very rare event). As a more accurate start you could just consider that they are deformable objects, assume that each collision has a moment in time when everything is maximally deformed, and what are the forces that result from these deformations, and send things off based on these forces (F=dp/dt). Other approximations could be made though, say just dividing up the momentum transfer based on which one is hit first, and give this an amount proportional do (the amount of deformation)/(the distance to the next object), or some such thing.

like image 135
tom10 Avatar answered Dec 09 '22 21:12

tom10


Be careful to test all possible pair-wise interactions before computing any forces, changes in velocity, energy, etc. Sounds like your physics simulation is trigger happy about computing the dynamics right away after the first collision it detects.

like image 40
DarenW Avatar answered Dec 09 '22 21:12

DarenW