I have several balls in a world that collide with each other. There are static walls on all sides of the world.
Sometimes, they end up in a position where they keep on moving up/down or left/right along the same path (motion perpendicular to the wall?)
Is there any easy way to detect this, and then, apply a little rotation to it on either direction?
Pseudocode or code in any language that has box2d would be appreciated.
Edit: Image, as requested by @Andrew

If the ball keeps moving like this (left/right/left/right...), I want to give it a little push so it moves from the current path.