# Discussion Forums: Open Discussion - multiple simultaneous collisions

 By: nobody ( Nobody/Anonymous ) What about multiple simultaneous collisions   2003-04-09 20:44 This is an issue I have not seen addressed often. For a practical application consider a rack of pool balls and the collision on the break. I have tried to model this by approximating 3 ball collisions which looks ok, but I think my method is incorrect. Solving for energy in these situations I think may be impossible. I really haven't looked into it that much. I know the basic 2 ball collision doesn't work in these situations. What I was really looking for was a fast way to distribute energy through a connected net of touching objects ( which I can build by detecting collisions over time intervals). I need to propagate energy through the net. Each object has different velocity. It could just be an approximation and does not have to solve for energy for my purposes. I also need an algorithm that does not get stuck in infinite loops and resolves so that the next instant in time does not result in a new collision within the network of objects. One that takes into account for different elasticity of objects would be impressive. Anyone ???
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2003-04-10 03:20 Yes, conservation of energy will give one equation (because energy is a scalar quantity) so, on its own, it will not be enough to calculate the resulting linier and angular velocities. Even if we include the equations from the conservation of angular and linier momentums (vector quantities) we will not have enough equations to solve all the unknowns. I think we need to construct all the impulses between objects, each impulse is between two objects but all these impulses combine in a similar way to a static framework of forces. There must be a way to solve this by starting at the outside so we do not get into loops? I think we also need to add in some random factors because the rack will not be precise and so there may be minute gaps between some pairs of balls, or some angles may not be exact. It seems to me that in multiple collisions small differences are greatly magnified, so if one collision happens a nanosecond before another this will have an enormous effect. I assume that is why games like pool and snooker are designed that way, so however good the players are, each game will still be different? Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2003-04-13 17:50 First I was thinking of keeping the collisions instantaneous because if you model things so that collisions take time then things get much more complicated. My program projects the balls ahead in time and finds their next collision. If two collisions occur within the same time step then I cheat and call them simultaneous. For things like pool balls this works ok but as things get more elastic/deformable and collisions take longer this would not be acceptable. You can still maintain a conservation of momentum in a multiball collision. I approximate the resulting velocities by first solving for all two ball collisions independently. Then I scale back all vectors to account for conservation of momentum. It makes sure that one ball colliding with 2 or more balls does not result in more force going out than going in. What makes this more complicated is that these resulting forces often generating new collisions in the net. I have a loop that keeps on solving the collisions this way for about 50 cycles then if it still isn't resolved ( In the worst case the collisions just go round and round in the net never stopping ) I kill the force in deadlocked balls so that others can move. This is very kludgy but surprisingly gives ok results. For pool balls there is also a special case which says that one ball cannot collide with more that 6 other balls as long as the balls stay on the table top.
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2003-04-14 09:09 Thank you very much for this, it is useful to get other peoples experience of what works in practice. Just from a purely theoretical point of view, I would have thought that it would be more accurate to treat a rapid sequence of collisions as seperate two-way collisions, where they are not actually in stationary contact, although I can see that this might be difficult to do. Martin
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2003-04-15 10:52 Thank you, these are really good examples. I need to think in pictures so I have drawn the first example here: http://www.martinb.com/physics/dynamics/collision/multiple/index.htm I have put my thoughts and ideas there and I would welcome any ideas about this. Martin
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2004-01-25 10:40 Hi Stephen, Thanks very much for this, it looks right to me because all the impulses add up to zero: Impulse on A = (-0.12 , 0) Kg m/s Impulse on B = (0, 0) Kg m/s Impulse on C = (0.06 , 0.03464) Kg m/s Impulse on D = (0.06 , -0.03464) Kg m/s ---------------------------------------------- Total = (0,0) Do you have any thoughts on how this could be made a bit more general, for instance a lot of people seem to be building snooker games and would like to accurately model the situation where a number of snooker balls are touching but perhaps are not quite as symmetrical as in this case. I usually find I cant work out the impulses without knowing the final velocities and I cant work out the final velocities without knowing the impulses. I wonder if it could be done by having a set of impulses radiating out from the initial collision to the balls on the outside, and then another set of impulses being reflected back to account for the inertia of the balls? If that wont work then I guess it would have to be a complicated set of simultaneous equations? I tried: http://www.sriley.co.uk/chaotic but I got an error message "Not Found : The requested document or URL could not be found on this server" But I did try some of the other applets on your site and they are very good. I will link to your message from my web page if that's alright. Thanks, Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2004-01-26 07:48 Hi Martin, Oops, my link should've been all lower case: http://www.sriley.co.uk/chaotic . I do have thoughts about how this can be made more general, but only as far as elastic collisions are concerned, where friction and rotation are absent. In reality collisions occur over finite time of course, so for multiple touching balls it might well be easier just to integrate forces over time, as happens in a real collision. Or compromise by handling a 3-ball symmetric collision nicely as a special case and non-symmetric ones by one collision at a time. Just for interests sake I have an expression for a symmetrical elastic collision where balls C and D are at some arbitrary angle (other than 60 degrees as in your example) though. It'll be easier if I express this in terms of a 3 ball collision rather than 4, so the balls are A,B and C, with A the only one initially moving. The expression I came up with is : A.(n1 + n2) j = --------------- (n1.n2)+2 And the final velocities given by : A' = A - j*(n1+n2) B ' = j* n1 C ' = j* n2 Primed letters are post-collision velocities, n1 and n2 unit normals and j the impulse. "." is a dot product. Masses don't appear because they're all equal. Symmetric here means that A bisects n1 & n2, or equivalently n2 is a refection of n1 about A's direction. For example on your diagram n1 and n2 [ (0.866, 0.5) and (0.866, -0.5) ] were reflections of each other about the line (1,0) which is A's velocity vector, so that was a symmetrical collision - both balls receive equal impulse. So for example in your diagram the balls are at 60 degrees to each other we have: n1 = (0.866, 0.5) , n2 = (0.866, -0.5), A=(1,0) So j = (1,0).[ (0.866, 0.5) + (0.866, -0.5) ] / ((0.866, 0.5) .(0.866, 0.5) +2) = 0.6928 And the final velocities: A' = (1,0) - 0.6928 ( (0.866, 0.5) + (0.866, -0.5) ) = (-0.2, 0) B' = 0.6928 * (0.866, 0.5) = (0.6, 0.3464) C' = 0.6928 * (0.866, -0.5) = (0.6, -0.3464) I also have a more general result for a non-symmetrical collision of different masses and all 3 moving, but since I've done little checking on it, it's more complicated and isn't really applicable to snooker where rotation and friction needs to be handled I won't post that. Stephen Riley
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2004-01-27 01:11 Stephen, > Oops, my link should've been all lower case: http://www.sriley.co.uk/chaotic This is very good, is this a permanent page? as I'd like to link to it, if that's alright? Your expression for 3 ball collision is very interesting, how did you derive it? Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2004-01-27 14:13 Hi Martin, Yes, the page is permanent and I would be happy for you to link to it. I derived the expression from conservation of momentum and energy, as a fairly straightforward extension of the method used for two bodies. The following links go into the major issues for two bodies: impulse/index.htm http://www.d6.com/users/checker/dynamics.htm#samples http://www.cs.cmu.edu/afs/cs/user/baraff/www/pbm/pbm.html If a diagram is drawn similar to your first, but with just 3 balls (say ball A on the left, B & C to the right), it can be seen from that that the magnitude of the impulse acting between A and B must equal that between A and B, since it's a symmetric collision. Also that the impulse on A must be the vector sum of those two impulses, but oppositely directed, by conservation of momentum. Since the magnitude of the impulse is used in all three ball collisions and the directions (normal to the surfaces) are known beforehand, it's easier to solve for a scalar impulse, applied in known directions, to get a vector impulse later. Since I know masses are going to cancel (because they're all equal) I'm being lazy and not carrying mass around. A bit sloppy, but gives the same answer. Putting that algebraically: A' = A - j*(n1 + n2) B' = j * n1 C' = j * n2 Where primed values are post collision velocities. "." is a dot product, A,B and C pre-collision velocities, n1 and n2 normals and j the magnitude of the impulse. All are vectors except j. The only ball originally moving is A. The only unknown is j. Post collision velocities A', B', C' can be found once j is found. Conservation of energy gives another equation: A'.A' + B'.B' + C'.C' = A.A I've already divided this through by 0.5 (and mass again). This just says that the sum of the 3 balls kinetic energy after collision equals the original kinetic energy, that of the sole originally moving ball. If A', B' and C' from the first 3 equations are substituted into the last equation and solved for j we end up with a quadratic equation with solutions J=0 and the equation I posted last time. Stephen Riley
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2004-01-28 11:19 Hi Stephen, Thanks again, I've linked to your applet from the following pages: twod/index.htm multiple/index.htm openDiscussion.htm and included this discussion in the last one. I will work through this and update the contents of the pages, but that will take me a bit longer. cheers, Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2004-01-28 18:21 Hi Martin, I've knocked up a fuller derivation, including masses this time, plus an applet showing the result for various angles entered (though still a symmetric collision). http://www.sriley.co.uk/Symmetric Stephen Riley (Now I really should get on with other things, was fun :)
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2004-01-30 03:28 Stephen, Ok, I'll let you get on with other things. The Symmetric page is great. Martin

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

Dynamics of Multibody Systems

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 Dark Basic Professional Edition - It is better to get this professional edition This is a version of basic designed for building games, for example to rotate a cube you might do the following: make object cube 1,100 for x=1 to 360 rotate object 1,x,x,0 next x Game Programming with Darkbasic - book for above software

This site may have errors. Don't use for critical systems.