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.

This commit is contained in:
Benoit Bolsee 2009-01-13 22:21:04 +00:00
parent b71bc3a2f3
commit 7f5073729f

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