Convert ragdoll Drag Script from 3D to 2D?

I have this script and it allows you to drag a 3d gameobject around (with collider attached)

with this script you can drag throw an object and it will move like a ragdoll.
(I have spent at least an hour trying to figure it out but I just can’t do it.)

using UnityEngine;
using System.Collections;

public class Ragdoll : MonoBehaviour
	public float maxDistance = 100.0f;

	public float spring = 50.0f;
	public float damper = 5.0f;
	public float drag = 10.0f;
	public float angularDrag = 5.0f;
	public float distance = 0.2f;
	public bool attachToCenterOfMass = false;

	private SpringJoint springJoint;

	void Update()

		Camera mainCamera = FindCamera();

		RaycastHit hit;
		if(!Physics.Raycast(mainCamera.ScreenPointToRay(Input.mousePosition), out hit, maxDistance))
		if(!hit.rigidbody || hit.rigidbody.isKinematic)

			GameObject go = new GameObject("Rigidbody dragger");
			Rigidbody body = go.AddComponent<Rigidbody>();
			body.isKinematic = true;
			springJoint = go.AddComponent<SpringJoint>();

		springJoint.transform.position = hit.point;
			Vector3 anchor = transform.TransformDirection(hit.rigidbody.centerOfMass) + hit.rigidbody.transform.position;
			anchor = springJoint.transform.InverseTransformPoint(anchor);
			springJoint.anchor = anchor;
			springJoint.anchor =;

		springJoint.spring = spring;
		springJoint.damper = damper;
		springJoint.maxDistance = distance;
		springJoint.connectedBody = hit.rigidbody;


	IEnumerator DragObject(float distance)
		float oldDrag             = springJoint.connectedBody.drag;
		float oldAngularDrag     = springJoint.connectedBody.angularDrag;
		springJoint.connectedBody.drag             = this.drag;
		springJoint.connectedBody.angularDrag     = this.angularDrag;
		Camera cam = FindCamera();

			Ray ray = cam.ScreenPointToRay(Input.mousePosition);
			springJoint.transform.position = ray.GetPoint(distance);
			yield return null;

			springJoint.connectedBody.drag             = oldDrag;
			springJoint.connectedBody.angularDrag     = oldAngularDrag;
			springJoint.connectedBody                 = null;

	Camera FindCamera()
		if (GetComponent<Camera>())
			return GetComponent<Camera>();
			return Camera.main;

Ok instead of converting to 2D I made a work around, I attached a regualar rigidbody and box collider to the object and it worked, I know this wasn’t a very professional way of working but it worked.