Kinematic object for selective collision

Hi,

I am new to unity and trying make my first Pong game.

In the game I have two bars on the two sides of the screen with which a ball collides.
The user can move the bars up and down and I have set up top and bottom boundaries to ensure that the bars stay within the screen.

On collision with the ball, I do not want the bars to move. So, I set the isKinematic property for these bars to true. But the problem is when I set isKinematic for the bars to true, the bars also do not collide with the boundaries and they leave the screen.

Please provide pointers on how can I solve this problem?

I would suggest using Mathf.Clamp whenever you move the bars. This will prevent them going outside of the limits you have set.