/// <inheritdoc/> public void Apply(ForceField forceField) { if (forceField == null) { throw new ArgumentNullException("forceField"); } if (forceField.Simulation == null) { return; } if (CollisionObject != null && CollisionObject.Domain == forceField.Simulation.CollisionDomain) { // Get objects touching the CollisionObject. var affectedObjects = forceField.Simulation.CollisionDomain.GetContactObjects(CollisionObject); foreach (CollisionObject affectedObject in affectedObjects) { RigidBody body = affectedObject.GeometricObject as RigidBody; if (body != null && body.MotionType == MotionType.Dynamic) { forceField.Apply(body); } } } }
/// <inheritdoc/> public void Apply(ForceField forceField) { if (forceField == null) { throw new ArgumentNullException("forceField"); } var simulation = forceField.Simulation; if (simulation != null) { int numberOfRigidBodies = simulation.RigidBodies.Count; if (Exclude != null) { for (int i = 0; i < numberOfRigidBodies; i++) { var body = simulation.RigidBodies[i]; if (body.MotionType == MotionType.Dynamic && !Exclude(body)) { forceField.Apply(body); } } } else { for (int i = 0; i < numberOfRigidBodies; i++) { var body = simulation.RigidBodies[i]; if (body.MotionType == MotionType.Dynamic) { forceField.Apply(body); } } } } }
/// <inheritdoc/> public void Apply(ForceField forceField) { if (forceField == null) { throw new ArgumentNullException("forceField"); } if (RigidBodies != null) { int numberOfRigidBodies = RigidBodies.Count; for (int index = 0; index < numberOfRigidBodies; index++) { var body = RigidBodies[index]; if (body != null && body.MotionType == MotionType.Dynamic) { forceField.Apply(body); } } } }