Fix in btCompoundShape that can cause removeChildShapeByIndex to crash.

Thanks to Benoit for the report and proposed fix:
http://code.google.com/p/bullet/issues/detail?id=171
This commit is contained in:
erwin.coumans
2009-01-19 07:32:24 +00:00
parent 994224c94f
commit ed4fab6c47

View File

@@ -56,8 +56,7 @@ 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);
@@ -76,10 +75,12 @@ 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::updateChildTransform(int childIndex, const btTransform& newChildTransform)