I have used same strategy and is sure to work on any level because eventually it'd just converge the ball towards the box.
I also try to make the box the area in my polygon with the lowest potential energy. It seems to (mostly) obey conservation of energy, so....