Click to See Complete Forum and Search --> : another stinking ball collision problem

12-13-2002, 04:53 PM
i realize this is a common problem, but while ive seen many posts on the subject, no one seems to be addressing the major problem as i see it.

detecting collision is no sweat. even the physics of the balls bouncing off one another isnt so bad ( found a great explanation www.plasmaphysics.org.uk/print/collision.htm )

the real problem is that the balls are never exactly twice the radius apart (they overlap). this makes for some unnatural effects like the balls jiggling together a few times before separating. to stop this, i tried preventing two balls that have just collided with colliding again for a while. unfortunately, there remains some lingering weirdness, like sling-shoting.

i think the elastic collision has to be calculated at the point mid-frame when the balls are exactly 2r apart, but i dont know how to do this with 2 objects moving at arbitrary velocities.

does anyone have a definitive solution for just this part of ball collision?


12-15-2002, 07:36 AM
One way to overcome that nasty jiggling is if there is a positive collision detection of two balls having their centres less than twice the radii (i.e. overlapping), then place them at EXACTLY twice the radii apart (ie. just touching) BEFORE you calculate the "bouncing angles". This does require a bit of trig to determine how far to move each ball apart on the same line of action that they were travelling on.......but just off the top of my head an easier way could be.....a multiplication factor of each (-ve) x and y velocity component - this factor being the ratio of (half overlap amount/radii)....I think - but you get the idea.

Anyway its sunday morning and second breakfast awaits..