I'm making a soccer game. I wonder if it's possible to let the ball pass through the goalkeeper if it's coming from behind him, but bounces off the goalkeeper when the ball comes from the front or above.

In the game I have now (download game) the goalkeeper is an immovable object, so the ball bounces off him. I would like to disable collision when the ball comes from behind, so he doesn't keeps on scoring owngoals and the ball can come into play again.