From 7f5073729f5fafe4118edb18ac10abbab66bf0c7 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Tue, 13 Jan 2009 22:21:04 +0000 Subject: [PATCH] Bullet bug fix: bad pointer in btCompoundShape::addChildShape() - patch submited to Bullet forum. This bug fix is needed in preparation of the setparent coumpound shape patch. --- .../src/BulletCollision/CollisionShapes/btCompoundShape.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.cpp index f08b810eadb..997361a5069 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.cpp @@ -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)