diff --git a/src/BulletCollision/CollisionShapes/btCompoundShape.cpp b/src/BulletCollision/CollisionShapes/btCompoundShape.cpp index 8842fa2f1..e8c8c336c 100644 --- a/src/BulletCollision/CollisionShapes/btCompoundShape.cpp +++ b/src/BulletCollision/CollisionShapes/btCompoundShape.cpp @@ -18,7 +18,7 @@ subject to the following restrictions: #include "BulletCollision/BroadphaseCollision/btDbvt.h" #include "LinearMath/btSerializer.h" -btCompoundShape::btCompoundShape(bool enableDynamicAabbTree) +btCompoundShape::btCompoundShape(bool enableDynamicAabbTree, const int initialChildCapacity) : m_localAabbMin(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)), m_localAabbMax(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)), m_dynamicAabbTree(0), @@ -34,6 +34,8 @@ m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)) m_dynamicAabbTree = new(mem) btDbvt(); btAssert(mem==m_dynamicAabbTree); } + + m_children.reserve(initialChildCapacity); } diff --git a/src/BulletCollision/CollisionShapes/btCompoundShape.h b/src/BulletCollision/CollisionShapes/btCompoundShape.h index 141034a8e..ce3dfa2fe 100644 --- a/src/BulletCollision/CollisionShapes/btCompoundShape.h +++ b/src/BulletCollision/CollisionShapes/btCompoundShape.h @@ -70,7 +70,7 @@ protected: public: BT_DECLARE_ALIGNED_ALLOCATOR(); - btCompoundShape(bool enableDynamicAabbTree = true); + explicit btCompoundShape(bool enableDynamicAabbTree = true, const int initialChildCapacity = 0); virtual ~btCompoundShape();