Ejemplo n.º 1
0
        // 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);
        }
Ejemplo n.º 2
0
        // Slice object
        public void SliceObjectByPlanes()
        {
            // Empty lists
            DeleteCache();
            DeleteFragments();

            // SLice
            RFFragment.SliceMeshes(ref meshes, ref pivots, ref subIds, this, limitations.slicePlanes);

            // Remove plane info
            limitations.slicePlanes.Clear();

            // Stop
            if (HasMeshes == false)
            {
                return;
            }

            // Get fragments
            fragments = CreateSlices();

            // TODO check for fragments

            // Set demolition
            limitations.demolished = true;

            // Fragments initialisation
            InitFragments();

            // Event
            demolitionEvent.InvokeLocalEvent(this);
            RFDemolitionEvent.InvokeGlobalEvent(this);

            // Destroy original
            RayfireMan.DestroyFragment(this, rootParent);
        }