How to prevent objects from going through each other when using mouse?

I have a mesh that has a box collider and a rigidbody. I use a mouse to move that mesh. I also rotate that mesh with the mouse wheel. Script looks something like this now:

    }

function Update () {
	var pyoritaKatta = Input.GetAxis("Mouse ScrollWheel");
	transform.Rotate(100*pyoritaKatta * kadenKaantymisherkkyys * Time.deltaTime, 0, 0);

	var liikutaKattaX = Input.GetAxis("Mouse X");
	var liikutaKattaY = Input.GetAxis("Mouse Y");
	
	transform.Translate(liikutaKattaX * kadenLiikutusnopeusX * Time.deltaTime, liikutaKattaY * kadenLiikutusnopeusY * Time.deltaTime, 0,Space.World);
}

When I put a sphere with rigidbody to fall on top of the mesh, I can move the mouse so fast the sphere goes right through the mesh.

The other problem is the mouse controlled mesh can go through walls with colliders.

I can’t use Character Controller because it apparently comes with its own collision sphere.

Using Translate and Rotate will put things where you say, they won’t care about collision. You either need to implement OnCollisionEnter on those objects and have them inform this script to stop, or probably better, use the RigidBody functions MovePosition and MoveRotation