Beispiel #1
0
        /**
         * Updates the activation status of all (active/inactive) constraints in the solver. Active constraints will
         * only be marked as active in the solver if this component is enabled, they will be deactivated otherwise.
         */
        public void UpdateConstraintActiveStatus()
        {
            if (actor == null || !actor.InSolver)
            {
                return;
            }

            // Calculate solver active indices:
            List <int> solverActiveIndices   = new List <int>();
            List <int> solverInactiveIndices = new List <int>();

            for (int i = 0; i < ConstraintCount; ++i)
            {
                if (activeStatus[i])
                {
                    solverActiveIndices.Add(constraintOffset + i);
                }
                else
                {
                    solverInactiveIndices.Add(constraintOffset + i);
                }
            }

            Oni.DeactivateConstraints(actor.Solver.OniSolver,
                                      (int)GetConstraintType(),
                                      solverInactiveIndices.ToArray(),
                                      solverInactiveIndices.Count);

            Oni.ActivateConstraints(actor.Solver.OniSolver,
                                    (int)GetConstraintType(),
                                    solverActiveIndices.ToArray(),
                                    solverActiveIndices.Count);
        }