BEPUphysics.Constraints.Collision.ContactManifoldConstraintGroup.Add C# (CSharp) Method

Add() public method

Adds a constraint to the group.
public Add ( EntitySolverUpdateable manifoldConstraint ) : void
manifoldConstraint EntitySolverUpdateable Constraint to add.
return void
        public new void Add(EntitySolverUpdateable manifoldConstraint)
        {
            //This is a similar process to a normal solver group.
            //However, it does not attempt to change involved entities.
            //This is for two reasons:
            //-It is unnecessary; a contact manifold is always between the same two entities throughout its lifespan.
            //-It causes race conditions; this method is called in a multithreaded context and changing involved 
            // entities calls upon sequential-only methods.
            if (manifoldConstraint.solver == null)
            {
                if (manifoldConstraint.SolverGroup == null)
                {
                    solverUpdateables.Add(manifoldConstraint);
                    manifoldConstraint.SolverGroup = this;
                    manifoldConstraint.Solver = solver;
                }
                else
                {
                    throw new InvalidOperationException("Cannot add SolverUpdateable to SolverGroup; it already belongs to a SolverGroup.");
                }
            }
            else
            {
                throw new InvalidOperationException("Cannot add SolverUpdateable to SolverGroup; it already belongs to a solver.");
            }
        }