Physics Engine for Bouncing Balls