picked up objects go through walls

Hello so i have the player able to pick up a cube. But when the player goes to the wall the cube docent stop at the wall it just goes through. I want the cube to stop at the wall. the cube for moving the cube to the player is:

`	rigid.transform.localScale = Vector3(1,1,1);
	rigid.renderer.material = Capture;
	rigid.rigidbody.useGravity = false;
		rigid.MovePosition(transform.position + transform.forward * holdDistance);`

Put another camera as a child of the main camera.Make a new layer. Set the child cam’s culling mask to that new layer. Set the depth of the child camera to 1 and Clear Flags to ‘Don’t Clear’.
Then, once picked, change the picked objects layer to the one you made the child camera see.

Here’s what the function in my ‘Pick_Me_Up_Bro.js’ looks like.

    function PickMeUp(){
    transform.parent = PageHolder;
    transform.position = PageHolder.position;
    transform.rotation = PageHolder.rotation;
//Here's the layer changing line.
    transform.gameObject.layer = LayerMask.NameToLayer("Pages");
    Picked = true;
    if(EventActivator){
    EventHolder.active = true;
    }
    }