public void AddBody(SoftBody body) { if (body == null) { throw new ArgumentNullException("body", "body can't be null."); } if (softbodies.Contains(body)) { throw new ArgumentException("The body was already added to the world.", "body"); } this.softbodies.Add(body); this.CollisionSystem.AddEntity(body); events.RaiseAddedSoftBody(body); foreach (Constraint constraint in body.EdgeSprings) { AddConstraint(constraint); } foreach (SoftBody.MassPoint massPoint in body.VertexBodies) { events.RaiseAddedRigidBody(massPoint); rigidBodies.Add(massPoint); } }
public void AddBody(SoftBody body) { if (body == null) { throw new ArgumentNullException("body", "body can't be null."); } if (softbodies.Contains(body)) { throw new ArgumentException("The body was already added to the world.", "body"); } this.softbodies.Add(body); this.CollisionSystem.AddEntity(body); events.RaiseAddedSoftBody(body); foreach (Constraint constraint in body.EdgeSprings) { CBFrame.Utils.Logger.Debug("line260 body2.linearVelocity:" + constraint.body2.linearVelocity + ",body1.linearVelocity:" + constraint.body1.linearVelocity); AddConstraint(constraint); } foreach (SoftBody.MassPoint massPoint in body.VertexBodies) { events.RaiseAddedRigidBody(massPoint); rigidBodies.Add(massPoint); } }