Make ball travel into goal

Hey, Im trying to make a basic football or hockey type game.
I have the containing body making the pitch, made up of polygon shapes
The ball, the player and the opponent are all dynamic bodies.

I don't know how to make the ball travel past the physicalbody into the goal but keep the containment so that the players can't go into the goal.

I have tried changing the polygon shapes to make the goals so the ball can go into the goal, however as you'd expect so can the players.
I need to know how to stop them going past the goal line.

I was wondering if someone had a simple explanation of how I might go about this... or is it complicated?

Here's the playing field i want to achieve:
Player1 can move in the red box
Player2 can move in the green box
The ball can move in the outer blue box
Image


Thanks for your time.
Rob
The best way is to check out contact filtering. This is an easy way to allow bodies to individually pass other bodies.

Original thread: https://box2d.org/forum/viewtopic.php?t=6600