My question today is this, how does one go about adding a joint( in this case a fixed joint) through a script attached to the game object.
My end goal is to allow objects to attach themselves to any object they collide with by joints
Much thanks in advance

function OnCollisionEnter (collision : Collision)
{
if (collision.gameObject.GetComponent(RigidBody)!=null){
gameObject.AddComponent(FixedJoint);
gameObject.GetComponent(FixedJoint).connectedBody=collision.rigidbody;
}
}
// not tested but it should work.

good luck.

Maurice

Can confirm this. Although i was getting really weird behavior with multiple objects due to multiple instances of a new joint forming. I added in a bool to prevent multiple creations of joints from the same object. Could probably come up with something better but this worked really well for me. Kinda Katamari Damacy like.

public class JoinObjects : MonoBehaviour {

bool hasJoint;

void OnCollisionEnter (Collision collision)
{
	if (collision.gameObject.GetComponent<Rigidbody>() != null && !hasJoint) {
		gameObject.AddComponent<FixedJoint> ();  
		gameObject.GetComponent<FixedJoint>().connectedBody = collision.rigidbody;
		hasJoint = true;
	}
}

}