Bonding physics objects?

I want to connect some rigid bodies so they behave sorta like they’re glued together. I want them all to move together, (or since they’re also bonded to the ground, not move at all) unless a certain amount of force hits them. In this case, I want JUST the parts hit with a certain amount of force to disconnect from the rest. I’m assuming there’s no control for this yet, and if there isn’t, what could I do? If there is, what is it called? Any help is appreciated!

Does nobody have a solution?

I did something similar to this. I think you can remove sub-collision shapes from a compound shape, gonna look it up.

The solution would be doing what you describe. Join the parts and when the force is high enough you just break the connection.

Alright, thanks. I want it to behave as if they’re nailed together, more or less. When a large enough amount of force is applied (including gravity so parts don’t float) the parts will break off and be their own rigid body. I tried a few basic remedies, like grouping them with a custom control and setting all their masses to 0 until a certain amount of force occurs, but it made whole buildings float in the air. >.>

I’m asking how to join the parts, is what I mean. Is there a control for this?

Theres joints, compound collision shapes, joining of kinematic rigidbodies via the scenegraph and probably other solutions I don’t think about right now.

With compound collision shapes, how would I disconnect one from the rest?

Make a new compound shape minus that part… Or just remove that part.

2 questions now:

  1. How would I disconnect a compound collision shape’s child (as well as a spatial associated with it)?
  2. How would I monitor force? I know there’s the PhysicsCollisionListener, along with event.getAppliedForce(), but how would I substitute in gravity?

    Thanks for the help so far!

    Edit - Didn’t see your answer to the 1st question, my bad :stuck_out_tongue: disregard it
  1. similar to how you add it
  2. its the force of the impact, what else is there to know? gravity already influenced the impact.

    Theres all kinds of solutions, I suggest doing a very specific setup tailored to what you actually want to achieve (break walls or dismember a npc or whatnot). Just aiming for “general breakability” is probably a performance hog.

The plan is for a full building simulated as seperate wall/cieling/stair models that can be collapsable. I just don’t want it so that when the bottom floor is gone the next floor doesn’t magically continue floating. Also, if there’s a big overhang, I want it to fall off (because of gravity).

At the time, I have around 40 seperate Rigid Bodies in the scene, and as you said, it is a killer. I’m trying to optimize and add a lot for the next release of my game, and this is one huge part I wanna do.

Just replace it when it collapses, as the “Hello Physics” tutorial hints in the bottom section this is how most AAA games do it.

One more question here, how would I monitor the forces being applied to only one of the CompoundCollisionShape’s children? I have an update loop, in which I call:

for(ChildCollisionShape c : compCollShape.getChildren()) {



But I’m unsure of how to calculate force on each part separately. I’m also going to try joint based buildings next, once I’m home from school. Is there a way to monitor how much force a joint is under? Is there a prebuilt method for breaking a joint under a large enough amount of force? Sorry for asking a thousand questions, I’m just trying to clarify and figure things out. Thanks for all the help so far!

Collision listener, get local location of collision, check against shape part location, let that shape fall.

I see. Thanks! I’m pretty sure I know what to do now.