private void RecreateBreakableBody()
 {
     ProfilerShort.Begin("RecreateBody");
     bool wasfixed = RigidBody.IsFixedOrKeyframed;
     if (m_newBreakableBodies.Count == 1)
     {
         ProfilerShort.Begin("NewReplace");
         ProfilerShort.Begin("Close");
         BreakableBody.BreakableShape.ClearConnectionsRecursive();
         BreakableBody.BreakableShape.RemoveReference();
         CloseRigidBody();
         ProfilerShort.BeginNextBlock("2");
         BreakableBody = m_newBreakableBodies[0];
         RigidBody.UserObject = this;
         RigidBody.ContactPointCallbackEnabled = true;
         RigidBody.ContactSoundCallbackEnabled = true;
         RigidBody.ContactPointCallback += RigidBody_ContactPointCallback_Destruction;
         BreakableBody.AfterReplaceBody += FracturedBody_AfterReplaceBody;
         BreakableBody.BreakableShape.AddReference();
         ProfilerShort.BeginNextBlock("ReplaceFractures");
         BreakableBody.BreakableShape.GetChildren(m_childList);
         for (int i = 0; i < m_childList.Count; i++) //remove fractures
         {
             var child = m_childList[i];
             if (child.Shape.IsFracturePiece())
             {
                 BreakableBody.BreakableShape.RemoveChild(i);
                 m_childList.RemoveAt(i);
                 i--;
             }
         }
         m_childList.Clear();
         foreach (var fb in m_grid.m_fractureBlocksCache) //add fractures grouped by block
         {
             Matrix m = Matrix.Identity;
             m.Translation = fb.Position * m_grid.GridSize;
             var si = new HkdShapeInstanceInfo(fb.Shape, m);
             BreakableBody.BreakableShape.AddShape(ref si);
             si.RemoveReference();
         }
         ProfilerShort.BeginNextBlock("Connections");
         BreakableBody.BreakableShape.SetChildrenParent(BreakableBody.BreakableShape);
         Shape.BreakableShape = BreakableBody.BreakableShape;
         Shape.UpdateDirtyBlocks(m_dirtyCubesInfo.DirtyBlocks, false);
         Shape.CreateConnectionToWorld(BreakableBody);
         if(wasfixed)
         {
             if(MyCubeGridSmallToLargeConnection.Static.CheckGridSmallToLargeConnect(m_grid));
             {
                 RigidBody.Quality = HkCollidableQualityType.Fixed;
                 RigidBody.UpdateMotionType(HkMotionType.Fixed);
             }
         }
         ProfilerShort.BeginNextBlock("Add");
         HavokWorld.DestructionWorld.AddBreakableBody(BreakableBody);
         ProfilerShort.End();
         ProfilerShort.End();
     }
     else
     { //Old body is removed so create new one (should use matching one from new bodies in final version)
         foreach (var b in m_newBreakableBodies)
         {
             HavokWorld.DestructionWorld.RemoveBreakableBody(b);
             MyFracturedPiecesManager.Static.ReturnToPool(b);
         }
         ProfilerShort.Begin("OldReplace");
         ProfilerShort.Begin("GetPhysicsBody");
         var ph = BreakableBody.GetRigidBody();
         var linVel = ph.LinearVelocity;
         var angVel = ph.AngularVelocity;
         ph = null;
         ProfilerShort.End();
         if (m_grid.BlocksCount > 0)
         {
             ProfilerShort.Begin("Refresh");
             Shape.RefreshBlocks(RigidBody, RigidBody2, m_dirtyCubesInfo, BreakableBody);
             ProfilerShort.BeginNextBlock("NewGridBody");
             CloseRigidBody();
             var s = (HkShape)m_shape;
             CreateBody(ref s, null);
             RigidBody.ContactPointCallbackEnabled = true;
             RigidBody.ContactSoundCallbackEnabled = true;
             RigidBody.ContactPointCallback += RigidBody_ContactPointCallback_Destruction;
             Matrix m = Entity.PositionComp.WorldMatrix;
             m.Translation = WorldToCluster(Entity.PositionComp.GetPosition());
             RigidBody.SetWorldMatrix(m);
             RigidBody.UserObject = this;
             Entity.Physics.LinearVelocity = m_oldLinVel;
             Entity.Physics.AngularVelocity = m_oldAngVel;
             m_grid.DetectDisconnectsAfterFrame();
             Shape.CreateConnectionToWorld(BreakableBody);
             HavokWorld.DestructionWorld.AddBreakableBody(BreakableBody);
             ProfilerShort.End();
         }
         else
         {
             ProfilerShort.Begin("GridClose");
             m_grid.Close();
             ProfilerShort.End();
         }
         ProfilerShort.End();
     }
     m_newBreakableBodies.Clear();
     ProfilerShort.End();
 }