Hi there,
After experimenting a lot with friction, constraints (see http://www.bulletphysics.com/Bullet/php ... f=9&t=2631) and compound shapes, I came to the conclusion that something is missing in Bullet.... well, or, I'm missing something
Anyhow we want to be able to construct a complex body that acts as one object. However it should be able to 'break-off' certain parts if the stress on those parts becomes too great. Think of for instance a chair. If I push it, it will rotate as a whole. However if I kick one of it's legs, it should come off and the chair would fall as well since it's lacking support.
I initially thought of using btCompoundShape for this purpose. However this is one rigidbody containing multiple shapes. It isn't, what we need, multiple rigidbodies clustered to a single entity. Let me try to explain why using multiple shapes do not solve my problem.
One problem with the compound shape approach is that the mass is distributed uniformly across the shape. However if I want to make for instance a building, surely the floors would be heavier than the windows. It doesn't make any sense to have the same density for the whole object if that object is for instance a building.
Another problem is that internal-object collisions/stress is not available. If I have two rigidbodies lying on top of each other, gravity will produce 'stress' on the bottom object. I can measure this stress and for instance remove the object if the stress is too high (i.e., it 'breaks'). With a compound shape I cannot do this at all, simply because it's only one rigidbody. Example: suppose I have a building with two floors and four support beams. Suppose I remove three support beams. Since there is no inter-object stress, the remaining beam wouldn't collapse under the weight of the top floor. In fact the structure as a whole would remain intact, only with one beam, and would look very unnatural. Another example: Imagine a chair with styrofoam support legs and an iron seat. I want the structure to collapse under its weight as the beams simply cannot hold the weight of the iron seat. With a compound shape and its uniformly distributed mass and lack of internal-object collision/stress detection this isn't possible.
As said, instead of using a compound shape, one could also use constraints. But to be honest I find it very hard to produce realistic results with that. The constraints simply aren't rigid enough. Perhaps if we had a glue constraint or something like this, it could work. Such a constraint would break when a certain pull force is too big. When the constraint is active, the objects would move as if they were one object. I cannot seem to do this with the current constraints.
I can also choose to not use any constraints at all, nor any compound shapes. The problem with that is that structures are very unstable. One gentle push and the whole structure will come down like a cardhouse: there simply isn't any structural strength. I've tried to fiddle a bit with friction, but apart from being a bit of a hack, it didn't give me any structural strength and therefore didn't produce any realistic results.
My conclusion is therefore that something seems to be missing from Bullet, namely a collection of rigidbodies that are connected to each other using structural strength. A btCompoundRigidbody If I'm not mistaken, Havok has something called a breakable object. Perhaps it would be an idea to introduce something like this as well in Bullet?
Request: Breakable objects / structural strength
-
- Posts: 69
- Joined: Sat May 10, 2008 8:39 am
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Request: Breakable objects / structural strength
One option might be to remove the leg from the compound shape (this obviously means you can't share the shape among several bodies) and create it as a new body in its own right. I'm not sure if the API supports this though. Obviously you will have to give your new 'leg' body its own mass and moment of inertia.
So I think breaking objects up is possible, if a little cumbersome.
Detecting when to break the objects is a bit harder but can be done by looking at the impulses involved in contacts and breaking the object if it is hit hard by something else.
However choosing where on the object to break is not easy i think. It will not necessarily be where the contact occurred. I doubt this is an easy problem to solve in general but it might be possible for bullet to have some support in a restricted (but still commonly-occuring) subset of cases.
I like the idea of constraints having a "breaking point", this might be useful for ragdolls which are quite unrealistic if you do unpleasant things to them. Also, doors that come off their hinges, etc. It only needs to be an "onBreak" callback, the user code can do the dirty (and perhaps bloody) work.
However I don't think you could make a realistic chair using constraints though. It will be too elastic. The compound object approach is best for that I think. Perhaps constraints could be used in an invisible fashion, i.e. their solution is not translated into graphics, but used only to trigger the onBreak callback.
So I think breaking objects up is possible, if a little cumbersome.
Detecting when to break the objects is a bit harder but can be done by looking at the impulses involved in contacts and breaking the object if it is hit hard by something else.
However choosing where on the object to break is not easy i think. It will not necessarily be where the contact occurred. I doubt this is an easy problem to solve in general but it might be possible for bullet to have some support in a restricted (but still commonly-occuring) subset of cases.
I like the idea of constraints having a "breaking point", this might be useful for ragdolls which are quite unrealistic if you do unpleasant things to them. Also, doors that come off their hinges, etc. It only needs to be an "onBreak" callback, the user code can do the dirty (and perhaps bloody) work.
However I don't think you could make a realistic chair using constraints though. It will be too elastic. The compound object approach is best for that I think. Perhaps constraints could be used in an invisible fashion, i.e. their solution is not translated into graphics, but used only to trigger the onBreak callback.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Request: Breakable objects / structural strength
Such 'breakable' object is a single btRigidBody with a btCompoundShape, with some extra logic that approximates the collision impulse propagation through the individual parts of the compound shape.
When the impulse exceeds some threshold, the compound shape can be decomposed into smaller parts, spread over multiple btRigidBody objects.
We plan on creating a fracture demo that shows how to do this,
Thanks,
Erwin
When the impulse exceeds some threshold, the compound shape can be decomposed into smaller parts, spread over multiple btRigidBody objects.
We plan on creating a fracture demo that shows how to do this,
Thanks,
Erwin
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Request: Breakable objects / structural strength
Do you think it's sensible to try and reuse any of Bullet's code to do this as it sounds like the sort of thing the constraint solver is already doing?Erwin Coumans wrote:with some extra logic that approximates the collision impulse propagation through the individual parts of the compound shape.
-
- Posts: 69
- Joined: Sat May 10, 2008 8:39 am
Re: Request: Breakable objects / structural strength
Well, it could be more than a single btRigidBody and a btCompoundShape. I mean to my understanding that would only cover the case in which I break off one part of the shape right? I.e., breaking off one leg of a chair. However I want to be able to break off every possible individual part of that chair, if I apply the right amount of force.Erwin Coumans wrote:Such 'breakable' object is a single btRigidBody with a btCompoundShape, with some extra logic that approximates the collision impulse propagation through the individual parts of the compound shape.
Also how are you planning to distribute mass non-uniformly if you still have only one rigidbody and a compound shape? Perhaps I'm not quite following your idea here, but I think what I'm looking for is a more general case: multiple rigidbodies clustered into one entity.
Nonetheless I'm definitely interesting in that fracture demo!
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Request: Breakable objects / structural strength
No, it would cover all cases: any child shape (or combination of child shapes) of the btCompoundShape can spawn into its own btRigidBody. Note that this would assume that a model is pre-fractured into child shapes for a btCompoundShape.to my understanding that would only cover the case in which I break off one part of the shape right?
It is up to the developer to provide a reasonable approximation for the inertia tensor. btCompoundShape::calculatePrincipalAxisTransform already allows to provide a different mass for each child shape.distribute mass non-uniformly if you still have only one rigidbody and a compound shape
Hope this helps,
Erwin
-
- Posts: 69
- Joined: Sat May 10, 2008 8:39 am
Re: Request: Breakable objects / structural strength
Sure, however in that case I'm really interested in how you can "propagate the collision impulse through the individual parts of the compound shape"? To my knowledge this doesn't happen by default. Any pointers on how to do this would be greatly appreciated BTW. does this mean that a compoundshape is able to collapse under its own weight or will the collision impulses only propagate if caused by 'external forces'?Erwin Coumans wrote: No, it would cover all cases: any child shape (or combination of child shapes) of the btCompoundShape can spawn into its own btRigidBody. Note that this would assume that a model is pre-fractured into child shapes for a btCompoundShape.
Thanks for the tip, but... you lost me here Any documentation on this calculatePrincipalAxisTransform? I've looked here (http://continuousphysics.com/Bullet/php ... 62&p=10247), but I can't quite translate it to something my brain understands yetIt is up to the developer to provide a reasonable approximation for the inertia tensor. btCompoundShape::calculatePrincipalAxisTransform already allows to provide a different mass for each child shape.
TBH, for us it is more important that the collision impulse propagates through the entire object, and that I'm able to determine what internal shape receives what impulse (so that I can convert it into a rigidbody and break it off). If that works correctly, I'm sure I can work around that mass distribution problem.
Thanks for the help!