Orthographic Drag Script Problem

This code works for the X and Z axis, but it totally screws up at the Y axis. This script is attached to my camera object and its looking down in orthographic mode with a Y value of 15. However when I click, it will reset the Y value to 0 causing my camera to go under the “floor”. I have tried to do this myself and have also tried other scripts on forums but I keep getting this Y problem.

void Drag()
	{
		Vector3 dragOrigin = Vector3.zero;
		
		if ( Input.GetMouseButtonDown(0)){
		    dragOrigin = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 0);
		    dragOrigin = camera.ScreenToWorldPoint(dragOrigin);
		}
	 
		if ( Input.GetMouseButton(0)){
	 
		    Vector3 currentPos  = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 0);
		    currentPos = camera.ScreenToWorldPoint(currentPos);
		    Vector3  movePos =  dragOrigin - currentPos;
		    transform.position = transform.position + movePos;
		}
	}

I just want to be able to drag the floor.

By dragging the floor, do you mean moving the floor with a static camera, or as many games do, moving the camera by dragging the floor?

I mean the second. And someone gave me the solution. This is it:

void Drag()
 	{
  		dragging = Input.GetMouseButton(0);
		
	  	if (dragging) {
	   		camera.transform.Translate (new Vector3((Input.GetAxis("Mouse X")*-1) * sensitivity,(Input.GetAxis("Mouse Y")*-1) * sensitivity,0));
	  	}
	}

*-1 so that movement is not inverse.