Ejemplo n.º 1
0
        /**
         * Flags all particles allocated by this actor as active or inactive depending on the "active array".
         * The solver will then only simulate the active ones.
         */
        public virtual void OnEnable()
        {
            ObiBatchedConstraints[] constraintComponents = GetComponents <ObiBatchedConstraints>();
            constraints = new ObiBatchedConstraints[Oni.ConstraintTypeCount];

            // build constraints list:
            foreach (ObiBatchedConstraints c in constraintComponents)
            {
                constraints[(int)c.GetConstraintType()] = c;

                c.GrabActor();
                if (c.isActiveAndEnabled)
                {
                    c.OnEnable();
                }
            }

            if (!InSolver)
            {
                return;
            }

            // update active status of all particles in the actor:
            solver.UpdateActiveParticles();

            // maybe this actor makes the solver visible to a camera now:
            solver.UpdateVisibility();
        }
Ejemplo n.º 2
0
        /**
         * Flags all particles allocated by this actor as active or inactive depending on the "active array".
         * The solver will then only simulate the active ones.
         */
        public virtual void OnEnable()
        {
            if (InSolver)
            {
                LazyBuildConstraintComponentCache();
                foreach (ObiBatchedConstraints c in constraints)
                {
                    if (c != null && isActiveAndEnabled)
                    {
                        c.OnEnable();
                    }
                }

                // update active status of all particles in the actor:
                solver.UpdateActiveParticles();

                // maybe this actor makes the solver visible to a camera now:
                solver.UpdateVisibility();
            }
        }