Skip to main content
GameDev.net gamedev.net
🔒 Locked

Multi Collision using Newtonian Physics

Started by SamoaWarrior Apr 17, 2007 at 8:49 AM 1 replies 1.1k views
Original Post
SamoaWarrior
SamoaWarrior
I am trying to build game which requires simulating simultaneous (elastic)collision of several bodies. (I have the code for elastic collision between two bodies) This is the method I came up with: for each body { 1. form a single body which is equivalent to all other bodies 2. simulate collision of these two bodies } Is this the right way, or are there any other methods? There are two ways to accomplish the first step: a. Add the individual masses and velocities, or b. Form the mass and velocity of the combined body such that the momentum and velocity of the system is conserved. Again which is correct?
mrcheesewheel
mrcheesewheel
For true handling of multiple contacts in a static pile you must effectively setup a number of simultaneous equations corresponding to the number of constraints on the system (each collision being a constraint) and solve simultaneously (this applies to solving any complete system exactly). For non trivial systems this tends to involve inverting a very large matrix which is very expensive. As such you usually don't treat cases like this exactly, you simply let you collision treatment deal with it explicitly. Your collision treatment might, for example, be explicitly applying an impulse to an object that penetrated another to cause it to bounce back with appropriate velocity. This can be a reasonable approach providing velocities are relatively small and masses are of similar magnitudes and you pick a suitably small timestep (the size of the timestep determines the impulse force required to cause the impulse in one step). A system like that can't really handle objects falling into a static pile very well as impulse waves tend to propogate back and forth throguh the system. A more stable and generally simpler collision approach is to effectively apply a spring between any pair of particles that interpenetrate. The stiffer the springs and the smaller the timesteps the more accurate "hard" bodies are simulated as the cost of system stability (large forces might be present yet the particles should be stationary). Softer springs allow the bodies to interpentrate more but stabalise the system somewhat. In both of these systems multi body impacts are dealt with implicitly. As to your approaches, unless you require exact quantitative results for some scientific purpose, just give it a go and see how it looks.
Hope this helps,

Dan
SamoaWarrior
SamoaWarrior
That was really good, thanks! My application doesn't require that precise handling, so I'll it a shot.
And about timestep, I'm assuming a unit time, so the velocity equals the impulse.How does that work out??

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.