Erwin Coumans wrote:
In a nutshell, the iterative solver doesn't find a good solution when there are multiple constraints (contact, hinge) and bodies with large differences in mass (even 1kg vs 100kg is large). No good solution means that the constraints are still violated at the end, and this can be visible as penetration or gaps in the constraints.
It's still not clear to me whether the issue is large forces
or not. Coming from a (rudimentary) physics background, it doesn't make sense to talk about mass without acceleration and force. If I have 101 objects of mass 1kg, it is clearly possible for mass ratios of 100:1 to occur depending on simulation (drop a stack of 100 straight down onto 1, etc). I guess I'm asking if I have to worry about cases like this causing random instability.
Erwin Coumans wrote:
You can wrap your collision shape in a btCompoundShape and shift it using the child transform.
This is actually the first thing I did, but it doesn't change the center of mass of the compound shape (unless there's something else I need to do that I don't know). Here is psuedocode for what I'm doing (I'm actually using the libGDX Java bindings, so real code/example is probably not too useful):
Code: Select all
btBoxShape boxShape = new btBoxShape(new Vector3(aabb.radii.x, aabb.radii.y, aabb.radii.z));
btCompoundShape doorShape = new btCompoundShape();
doorShape.addChildShape(new Matrix4().setToTranslation(0, -aabb.radii.y, 0), boxShape );
The box shape has a center of mass + origin in the center of the box. Since we are making a door, we add it to the compound shape shifted by its half length. This achieve the door having the freedom to rotate like a real door does, since the hinge is now located at (0, 0, 0) with respect to the compound shape. However, as I understand it, the compound shape itself still has a center of mass at (0, 0, 0) (it seems all shapes do no matter what?). Therefore, gravity will still be applied at the hinge, which will do nothing since the linear factor is 0 and no torque is generated.
Am I missing something?