How do I swing player around a point using physics?

So right now I have a grapple that players can use to pull themselves to places. I want to add swinging functionality to this grapple (using physics) – I already have the visuals so I just need the physics to work now.

What I want: Imagine a ball (the player) rolling on the ground – the ball shoots out a grapple at the corner of a wall and the ball swings around the corner instead of simply rolling on.

edit:

here’s what I have so far:

function Swing(clawPos){
	var heading : Vector3;
	var sphereHeading : Vector3;
	var swingPoint : Vector3 = clawPos;
	
	heading = transform.position - swingPoint; 
	if(heading.magnitude < distanceCap){
		distanceCap = heading.magnitude;
	}
	sphereHeading = heading.normalized * distanceCap; 
	transform.position = swingPoint + sphereHeading;
}

Only problem is that, obviously, it doesn’t use the physics engine – so the player slows down as he swings around. Any way to get the rigidbody to maintain velocity, along the orbit, as it swings?

edit: ignore this post – I’m not using config joint anymore

I checked out the example posted by andeeee in this thread: http://forum.unity3d.com/viewtopic.php?t=38641

The configurable joint seems to work quite differently than I assumed it would… I’m not even sure if it’ll work for what I want.

You need to have the joint’s anchor point positioned so that it coincides with the point where the claw is located. You can make this happen by getting that point in world space and using transform.InverseTransformPoint to convert it to local space to use for the anchor point. If you have all linear motion set to Locked, the object should be catapulted around the wall.

Is it possible that the centrifugal force of the turn is what is making the object fly off? You might need to alter some of the basic mechanics (the friction with the ground, say) to stop this from happening.

I’m just thinking I don’t want to use the configurable joint… it’s like gluing a rod to the object – essentially, I want that rod to be collapsible and still allow the player to rotate freely and influence the swing with his existing addrelativeforce controls (which requires a pretty ridiculous setup and rotation was still influenced by joint when I tried it).

I’ve got another potential solution to experiment with though – I’ll post if I get it.

edit: I think I’ll go more this route:

http://forum.unity3d.com/viewtopic.php?t=32417

here’s what I have so far:

function Swing(clawPos){
	var heading : Vector3;
	var sphereHeading : Vector3;
	var swingPoint : Vector3 = clawPos;
	
	heading = transform.position - swingPoint; 
	if(heading.magnitude < distanceCap){
		distanceCap = heading.magnitude;
	}
	sphereHeading = heading.normalized * distanceCap; 
	transform.position = swingPoint + sphereHeading;
}

Only problem is that, obviously, it doesn’t use the physics engine – so the player slows down as he swings around. Any way to get the rigidbody to maintain velocity, along the orbit, as it swings?