Fixed Joint Question

Hi. I am wanting to used Fixed Joints to hold some components together (the individual boards of a raft). I am wondering if there is anyway to have the breakForce set on a joint reduce whenever a force is applied to the joint, eventually resulting in the joint breaking. For example, the breakForce might initially be set at 5, but after a number of small collisions (like force 1) the joint will break. I see there is a an OnJointBreak event, that will tell me when a joint breaks and what the force involved was - but I don’t see any way to see force events against the joint where the force wasn’t enough to break the join. I am thinking I could look at the collision events associated with the actual object the join is on, and the based on what the object collided with subtract some amount from the joint’s breakForce value. But I would really like to be able to see each of the non-breaking force events on the joint, and what the non-breaking force amounts were. Any ideas. Thanks.

You could use OnCollisionEnter’s Collision class to get the impact force (impactForceSum), and set your Joint.breakForce based on that.
The impactForceSum seems to be undocumented; it’s a Vector3 but you could get the magnitude and use that.

Thanks Profanicus. I thought maybe the Collision class might offer something, but I didn’t see anything in the documentation. I’ll have to see if I can track down more information on how to use the undocumented Collision.impactForceSum.

I’ve used it a bit, experimentation is your best bet unfortunately … if you find anything out please share, I’m guessing the Vector3 returned is the position and strength of the colliding force. Debug using impactForceSum.magnitude or sqrMagnitude, and see what kind of values are being returned and base your calculations from there.

You may find that reducing the break force like you plan is somewhat tricky - I find it difficult enough to get 1 break value behaving nicely let alone a range of them :slight_smile:
Another approach is to use a health value for each object, and decrease this if the impactForce is above a threshold. When health hit 0 break the joint manually.

I’ll experiment a bit more with impactForceSum, but I think you are probably right - it is going to be easier to simply maintain health values for my objects and break the joints manually when enough damage has been taken.