Gravity gun behavior

I have an idea that I’m sure one of you experienced Unity developers can help me with.

I would like to add a capability to the prefab first-person controller that mimics the “pick up” function in Half Life 2. For anyone unfamiliar with what I mean, basically if a dynamic object is within a given range and is centered in view a button can be pressed to pick it up. It will then hover in front of the player until the button is released.

Is there a simple way to do this that is perhaps built into the Physx engine?

I did a few searches for picking up objects and found what may be useful scripts, but I thought I would ask directly before I start monkeying around. The only part I’m really worried about is that the behavior in HL2 indicates a hinge type connection that displays some elasticity before breaking.

Thanks.

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

; )

Ah, sweet. Many thanks, drJones. Just what I was looking for.

As an follow up note, I just replaced the spring joint with a character joint (and the references in Joachim’s script of course). A few tweaks later and it’s precisely what I was looking for. Unity and the Unity community is amazing. Thanks again!