I have the following situation : I have a moving ball in a rectangular 2D chamber. When the ball touches the walls of the chamber it changes it's direction. It is simple to implement the ball movement when the chamber is empty ( it has only 4 walls). My question is , how to I implement the movement of the ball in a chamber with numerous objects in it ? ( by objects I refer to rectangular or square shapes). Also , I know the initial ball direction. I've tried using a matrix to map the room, but I got stuck in it. Have any good ides of how could this be done ?