// SLice mesh public static void SliceMesh(RayfireRigid scr) { // Empty lists scr.DeleteCache(); scr.DeleteFragments(); // SLice RFFragment.SliceMeshes(ref scr.meshes, ref scr.pivots, ref scr.subIds, scr, scr.limitations.slicePlanes); // Remove plane info scr.limitations.slicePlanes.Clear(); // Stop if (scr.HasMeshes == false) { return; } // Get fragments scr.fragments = RFDemolitionMesh.CreateSlices(scr); // TODO check for fragments // Set demolition scr.limitations.demolished = true; // Fragments initialisation scr.InitMeshFragments(); // Event scr.demolitionEvent.InvokeLocalEvent(scr); RFDemolitionEvent.InvokeGlobalEvent(scr); // Destroy original RayfireMan.DestroyFragment(scr, scr.rootParent); }