Bullet bug fix: bad pointer in btCompoundShape::addChildShape() - patch submited...
authorBenoit Bolsee <benoit.bolsee@online.be>
Tue, 13 Jan 2009 22:21:04 +0000 (22:21 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Tue, 13 Jan 2009 22:21:04 +0000 (22:21 +0000)
extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.cpp

index f08b810eadbc37ab728db159a43d04d1d9109275..997361a5069da7a50c6209ad9deb473ccd2130ff 100644 (file)
@@ -49,8 +49,6 @@ void  btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
        child.m_childShapeType = shape->getShapeType();
        child.m_childMargin = shape->getMargin();
 
-       m_children.push_back(child);
-
        //extend the local aabbMin/aabbMax
        btVector3 localAabbMin,localAabbMax;
        shape->getAabb(localTransform,localAabbMin,localAabbMax);
@@ -69,10 +67,11 @@ void        btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
        if (m_dynamicAabbTree)
        {
                const btDbvtVolume      bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
-               int index = m_children.size()-1;
+               int index = m_children.size();
                child.m_node = m_dynamicAabbTree->insert(bounds,(void*)index);
        }
 
+       m_children.push_back(child);
 }
 
 void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)