Exemplo n.º 1
0
        /**
         * Adds this actor from its current solver, if any.
         */
        public virtual bool RemoveFromSolver(object info)
        {
            if (solver != null && InSolver)
            {
                // remove collision ignore lists:
                for (int i = 0; i < particleIndices.Count; ++i)
                {
                    Oni.SetIgnoredParticles(solver.OniSolver, new int[] {}, 0, particleIndices[i]);
                }

                solver.FreeParticles(particleIndices);
                particleIndices = null;

                inSolver = false;

                solver.RemoveActor(actorID);

                if (OnRemovedFromSolver != null)
                {
                    OnRemovedFromSolver(this, null);
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
 public void RemoveFromSolver()
 {
     if (m_Solver != null)
     {
         m_Solver.RemoveActor(this);
         if (blueprint != null)
         {
             blueprint.OnBlueprintGenerate -= OnBlueprintRegenerate;
         }
     }
 }
        /**
         * Adds this actor from its current solver, if any.
         */
        public virtual bool RemoveFromSolver(object info)
        {
            if (solver != null && InSolver)
            {
                solver.FreeParticles(particleIndices);
                particleIndices = null;

                inSolver = false;

                solver.RemoveActor(actorID);

                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        /**
         * Removes this actor from its current solver, if any.
         */
        public virtual bool RemoveFromSolver(object info)
        {
            if (solver != null && InSolver)
            {
                // remove constraints from solver:
                foreach (ObiBatchedConstraints c in constraints)
                {
                    if (c != null)
                    {
                        c.RemoveFromSolver(null);
                    }
                }

                // remove rest positions:
                Vector4[] noRest = { new Vector4(0, 0, 0, 1) };
                for (int i = 0; i < particleIndices.Length; ++i)
                {
                    Oni.SetRestPositions(solver.OniSolver, noRest, 1, particleIndices[i]);
                }

                int index = solver.RemoveActor(this);
                particleIndices = null;

                // update other actor's triangle offset:
                for (int i = index; i < solver.actors.Count; i++)
                {
                    solver.actors[i].trianglesOffset -= deformableTriangles.Length / 3;
                }
                // remove triangles:
                Oni.RemoveDeformableTriangles(solver.OniSolver, deformableTriangles.Length / 3, trianglesOffset);

                inSolver = false;

                if (OnRemovedFromSolver != null)
                {
                    OnRemovedFromSolver(this, new ObiActorSolverArgs(solver));
                }

                return(true);
            }

            return(false);
        }