How to make a rigid body object you're carrying not go through walls?

I have a player who can carry objects with its gun in a “2.5D Platform Shooter” game but the problem I’m experiencing at the moment is that every time I make the player hold the object and hit the wall as seen on the picture below.

Example Problem 1

Then when the object that’s being pressed against the wall this turns out in my second picture below. Please help unity fans.

Example Problem 2

Does anybody know how to fix this problem? the object I’m carrying has a rigidbody. The code below is what I’m using to carry the object.

#pragma strict

var catchRange = 30.0;
var holdDistance = 4.0;
var minForce = 1000;
var maxForce = 10000;
var forceChargePerSec = 3000;
var layerMask : LayerMask = -1;       

@HideInInspector
var anim : Animator;
         
enum GravityGunState { Free, Catch, Occupied, Charge, Release};
private var gravityGunState : GravityGunState = 0;
private var rigid : Rigidbody = null;
private var currentForce = minForce;
     
function FixedUpdate() 
{
   if(gravityGunState == GravityGunState.Free) 
   {
     if(Input.GetButton("Fire1")) 
     {	anim.SetBool("Shoot", true);
     	var hit : RaycastHit;
        if(Physics.Raycast(transform.position, transform.forward, hit, catchRange, layerMask)) 
        {
        	if(hit.rigidbody) 
        	{ 
        		rigid = hit.rigidbody;
            	gravityGunState = GravityGunState.Catch;
            	
         	}
        }
      }else if(!hit.rigidbody){anim.SetBool("Shoot", false);}
    }

		else if(gravityGunState == GravityGunState.Catch) 
        {	 
        	rigid.useGravity = false;
            rigid.MovePosition(transform.position + transform.forward * holdDistance);
            if(!Input.GetButton("Fire1"))
                gravityGunState = GravityGunState.Occupied;
        }
        
        else if(gravityGunState == GravityGunState.Occupied) 
        {
        	
          	  if(Physics.Raycast(transform.position, transform.forward, hit, catchRange, layerMask)){
        		Debug.DrawLine (transform.position, hit.point, Color.red);
        }  	 
            rigid.MovePosition(transform.position + transform.forward * holdDistance);
            if(Input.GetButton("Fire1"))
            gravityGunState = GravityGunState.Charge;
        }
        
        else if(gravityGunState == GravityGunState.Charge) 
        {
            rigid.MovePosition(transform.position + transform.forward * holdDistance);
            if(currentForce < maxForce) 
        {
                currentForce += forceChargePerSec * Time.deltaTime;
        }
         
         else 
         {		
                currentForce = maxForce;
         }
         
         if(!Input.GetButton("Fire1"))
         gravityGunState = GravityGunState.Release; 
         rigid.useGravity = true; 
        }
        
        else if(gravityGunState == GravityGunState.Release) 
        {	
            rigid.AddForce(transform.forward * currentForce);
            currentForce = minForce;
            gravityGunState = GravityGunState.Free;
        }
        
    }
     
    @script ExecuteInEditMode()

Lols, I think I might have figured it out. I adjusted the size of my wall and floor collider sizes as long and wide as I can because as you guys said to me was that since I’m carrying the box at a certain speed it tends to pass through the wall because it was too THIN. Apparently, you have to make it THICK so the box won’t pass through at all

But only prob is that the object cuts the corner of the wall and floor. But I adjusted the size.
and the other is when the object is being enforced to the ground it will make the object do a major bounce.

You shouldn’t use rigidbody.MovePosition(). When you do, your object might be teleporting or moving directly past the object, or it must be going a little further than the objects center thus causing it to come to the other side. You should rather use AddForce() or (not recommended) modify the objects velocity directly, or if you want to use MovePosition, scale it by Time.deltaTime. Eg: rigid.MovePosition(transform.position + transform.forward * holdDistance * Time.deltaTime);