Since the 2D joints in unity do not seem to have a break force/torque built in, I wanted to write it in a script myself by reading the joints reaction force in the following code:
var breakForce : float = 100;
private var jointForce : float;
function Start() {
var joint = gameObject.AddComponent(HingeJoint2D);
}
function FixedUpdate() {
jointForce=joint.GetReactionForce;
if (jointForce>breakForce) {
Destroy(joint);
}
}
The documentation says that HingeJoint2D.GetReactionForce
should be possible:
http://docs.unity3d.com/ScriptReference/HingeJoint2D.GetReactionForce.html
However unity tells me: ‘GetReactionForce’ is not a member of ‘UnityEngine.HingeJoint2D’.
This made me very confused. I hope someone can help me!