Room with balls

Started by
-1 comments, last by darkseed 16 years, 7 months ago
Sorry for the noobish question. I have a 2D Flash game that contains a room with balls that collide with the walls and among themselves. I've used a circle-circle CD algorithm from Gamasutra (http://www.gamasutra.com/features/20020118/vandenhuevel_01.htm) and a line-circle CD algorithm from a Flash tutorial (http://www.tonypa.pri.ee/vectors/tut07.html). I have problems when a ball collides with other balls at the room edges (simultaneous line-circle and circle-circle collisions). I think that happens because the circle-circle algorithm moves the balls to avoid penetration and afterwards the circle-line collision moves the ball again to avoid intersection with the line and, doing this, the balls may intersect again. Doing this, the collision response is run several times and the balls act weird. Some times, the balls cross the wall and exit the room, I guess this problem has the same cause. The basic question is: how do I handle several collisions at the same time step? Could someone help (possibly with a reference to a tutorial)?

This topic is closed to new replies.

Advertisement