Keep a certain distance between two RigidBodies

I’m working on a grappling hook, and I want to keep a certain distance between two RigidBodies, while still letting one orbit the other. An example of what I’m looking for is the grappling hook in Floating Point. The ‘rope’ is rigid and has no give.

My current solution is to apply a force to keep it a certain distance away, but it’s really wobbly. Is there any way other than joints to do this?

if (Vector3.Distance(transform.position, contactPoint) > distanceToGrapplePoint) {
    				rigidbody.AddForce(contactPoint - transform.position);
    			} else if (Vector3.Distance(transform.position, contactPoint) < distanceToGrapplePoint) {
    				rigidbody.AddForce(transform.position - contactPoint);

may be you should try joints instead of script

The correct way to do this is joints. There is no valid reason to be avoiding joints.

The solution you have coded is equivalent to a spring joint, where the force added is proportional to the distance away from the target position.

What you are actually after is a fixed joint. On fixed joints any force applied to either object is spread out across both objects. That’s a lie, but you get the idea.

In most cases its easier to simply learn and use Unity’s built in physics system, as opposed to writing your own. Joints are not that hard.