Browse Source

breakShape() - remove parts created with invalid object box along with empty parts.

yourarcade 9 years ago
parent
commit
7480dea1a9
1 changed files with 9 additions and 3 deletions
  1. 9 3
      Engine/source/ts/tsPartInstance.cpp

+ 9 - 3
Engine/source/ts/tsPartInstance.cpp

@@ -107,10 +107,16 @@ void TSPartInstance::breakShape(TSShapeInstance * shape, S32 subShape, Vector<TS
    // update bounds (and get rid of empty parts)
    for (S32 i=0; i<partList.size(); i++)
    {
-      if (partList[i]->mMeshObjects.size())
+      if (partList[i]->mMeshObjects.size()){
          partList[i]->updateBounds();
-      else
-      {
+         // Remove any parts parts with invalid box
+         Box3F box = partList[i]->getBounds();
+         if(!box.isValidBox() ){
+            Con::warnf("TSPartInstance::breakShape - part created with invalid object box. Removing from list.");
+            partList.erase(i);
+            i--;
+         }
+      }else{
          partList.erase(i);
          i--;
       }