I have a component based engine that works by first creating an instance of btRigidBody in one object, along with a compound shape to house the actual collision shapes relative to the origin of the object. The btCollisionShape instances live in other objects, which are added later (relatively speaking).
If I create a compound shape and a rigid body with the empty compound shape, Bullet goes nuts after I add more child shapes later. I refactored my code to delay the creation of both the original compound and the rigid body until one child shape is available, and that solves the problem and the simulation is stable again. The fact that an empty compound shape is not viable on its own is probably either a bug, or something that is probably not a very uncommon occurrence in a similar situation when loading shapes from resource files and should be documented and/or asserted.
Another problem came up when I tried to manipulate the positions of the child shapes in the compound shape using updateChildTransform. The function crashes on the line:
Code: Select all
m_dynamicAabbTree->update(m_children[childIndex].m_node,bounds);
Code: Select all
child.m_node = m_dynamicAabbTree->insert(bounds,(void*)index);
Code: Select all
childShape->getAabb(newChildWorldTrans,aabbMin0,aabbMax0);
It would be great if someone who better understands the internals could make a fix to this that I could apply without having to wait for the next release. Also an explanation about what's going on with the nodes would possibly help me to track down the problem myself.
Thanks in advance for any advice.