I’d like to have a joint that can be broken when enough force is acting on it. It seems like I ought to be able to modify FixedConstraint
a little bit and get the job done, but the implementation is very intimidating
Yeah, breakable joints are not supported yet by nphysics.
Here is how I think this could be done:
- Add a
broken
flag (initially set tofalse
) to theFixedConstraint
. - In the cache_impulses method, check if any impulse is greater than some user-defined value. If it is, set the
self.broken
flag totrue
. - Change that and that to be zero if
self.broken == true
. - Change that and that so they do nothing if
self.broken == true
.
This is currently no mechanism in place to make the MechanicalWorld
automatically delete a joint. So I guess that would be the user’s responsibility. Otherwise, we could add a is_broken
method to the JointConstraint
trait which the MechanicalWorld
will call at the beggin of each step to detect if the joint broke, and removed it if necessary.
1 Like