Saturday, April 9, 2011

3


Problem:  A program was made to joint balls in Box2D together whenever they collided with each other. The program’s frame rate would drop to almost nothing as soon as this happened. When balls collided, a joint would be made to hold them together. This would lock them into a colliding position, so another joint would be made every frame. This quickly created thousands of joints, more than the computer could possibly process.  

Impact: The program was too laggy to use.

Solution:  A for loop was added that checks which balls are connected to every joint before creating a new joint. If a joint is found that already contains both balls about to be jointed, than no joint is made.

No comments:

Post a Comment