How can you carry rigidbodies without them appearing jumpy?

I’m writing a script that would allow a player to “carry” an object similar to how objects are carried with the gravity gun in Half Life 2. Since these objects are quite big, I have to worry about them not clipping through the floor, so I can’t just change the position. I have tried many approaches such as addForce and parenting, but the best way I have so far is changing the velocity on each step. But this has it’s own problems as the box appears jumpy when walking, and collisions with walls makes the box go crazy. Here is what I have so far:

The carry loop (in C#):

	IEnumerator carry(Transform obj) {
		obj.rigidbody.useGravity = false;
		while (carrying) {
				Vector3 center = transform.position + (transform.forward* 4);
				Vector3 objPos = obj.transform.position;
				
			    if (Vector3.Distance(objPos, center) > 1.5F) {
					break;
				} else if (Vector3.Distance(objPos, center) > .1F) {
					Vector3 Dir = center - objPos;
					obj.rigidbody.velocity = Dir * 50;
				} else {	
					obj.rigidbody.velocity = Vector3.zero;
				}
			yield return null;
		}
		obj.rigidbody.velocity = obj.rigidbody.velocity * .5f;
		obj.rigidbody.useGravity = true;
	}

How it is called:

	public void Update() {
		//If pressed E and not carrying
		if (Input.GetKeyDown(KeyCode.E) && !carrying) {
			RaycastHit hit;
	        if (Physics.Raycast(transform.position, transform.forward, out hit, 8)) {
				if (hit.rigidbody && !hit.rigidbody.isKinematic) {
					carrying = true;
					StartCoroutine(carry(hit.transform));
				}
			}
		} else if (Input.GetKeyDown(KeyCode.E) && carrying) {
			carrying = false;
		}	
	}

Any ideas on how to make this more smooth? Or is there a better way to do it rather than changing the velocity each call (which I know messes with the physics)

The dragObject script connects a spring between the thing you are dragging and an invisible “drag point” (which would probably be a child in front of your hands.) Getting springs set correctly is a pain, would need to be sure to damp lots, but that could work.

For the setting velocity solution, I’ve gotten better results by not “snapping” to a target speed. Instead of vel=???, use vel*=0.9f; vel+=???. The 1st part is fake drag (and could maybe just set the rigidbody drag very high.) When you have to change directions, thqt turns a “snap” into a few frames of slowing to reverse.

Getting the correct values is ugly. For example, with a drag of 10% (speed times 0.9) adding a speed of 5 will reach speed 50 (at speed 50 the 10% drag and the +5 cancel.) Values like times 0.75 (and more speed) will make it stiffer.