assign proper index when removing a child shape from btCompoundShape

Thanks to sparkprime for the report and fix in Issue 354
See http://code.google.com/p/bullet/issues/detail?id=354
Fix a few warnings
This commit is contained in:
erwin.coumans
2010-03-12 05:32:57 +00:00
parent f250fd21c5
commit 192a2b38e9
3 changed files with 8 additions and 4 deletions

View File

@@ -114,7 +114,9 @@ public:
void ProcessChildShape(btCollisionShape* childShape,int index)
{
btAssert(index>=0);
btAssert(index<compoundShape->getNumChildShapes());
btCompoundShape* compoundShape = static_cast<btCompoundShape*>(m_compoundColObj->getCollisionShape());

View File

@@ -110,6 +110,8 @@ void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
m_dynamicAabbTree->remove(m_children[childShapeIndex].m_node);
}
m_children.swap(childShapeIndex,m_children.size()-1);
if (m_dynamicAabbTree)
m_children[childShapeIndex].m_node->dataAsInt = childShapeIndex;
m_children.pop_back();
}