Prevent paddle from going through walls.

I have a paddle and it keeps going through a wall and it is not supposed to. How can i prevent it to stop going through? Please Provide the full code.

The paddle is called paddle and wall is called wall.

Use the layer collision mask in project settings/ physics . Make sure they have colliders.
or put a configurablejoint on the paddle to limit the range of movement (better idea.) no code needed either way.