public Arbiter(SequentialImpulsesSolver parent, Body body1, Body body2) { if (body1.ID < body2.ID) { this.body1 = body1; this.body2 = body2; } else { this.body1 = body2; this.body2 = body1; } this.tag1 = (SequentialImpulsesTag)this.body1.SolverTag; this.tag2 = (SequentialImpulsesTag)this.body2.SolverTag; this.circle1 = this.body1.Shape as CircleShape; this.circle2 = this.body2.Shape as CircleShape; this.friction = MathHelper.Sqrt( this.body1.Coefficients.DynamicFriction * this.body2.Coefficients.DynamicFriction); this.restitution = Math.Min(body1.Coefficients.Restitution, body2.Coefficients.Restitution); this.parent = parent; this.contacts = new LinkedList <ContactPoint>(); this.lastUpdate = -1; this.state = ContactState.New; this.ignoresCollisionResponse = body1.IgnoresCollisionResponse || body2.IgnoresCollisionResponse; }
/// <summary> /// Creates the physics object used in the game. /// </summary> public Physics() { // Set up the basic engine engine = new PhysicsEngine(); // Set up the collision detector engine.BroadPhase = new SweepAndPruneDetector(); //engine.BroadPhase = new SelectiveSweepDetector(); //engine.BroadPhase = new BruteForceDetector(); // Set up the solver SequentialImpulsesSolver solver = new SequentialImpulsesSolver(); engine.Solver = solver; solver.Iterations = 12; solver.SplitImpulse = true; //solver.BiasFactor = 0.7f; //solver.AllowedPenetration = 0f; }
public Arbiter(SequentialImpulsesSolver parent, Body body1, Body body2) { if (body1.ID < body2.ID) { this.body1 = body1; this.body2 = body2; } else { this.body1 = body2; this.body2 = body1; } this.tag1 = (SequentialImpulsesTag)this.body1.SolverTag; this.tag2 = (SequentialImpulsesTag)this.body2.SolverTag; this.circle1 = this.body1.Shape as CircleShape; this.circle2 = this.body2.Shape as CircleShape; this.friction = MathHelper.Sqrt( this.body1.Coefficients.DynamicFriction * this.body2.Coefficients.DynamicFriction); this.restitution = Math.Min(body1.Coefficients.Restitution, body2.Coefficients.Restitution); this.parent = parent; this.contacts = new LinkedList <Contact>(); }
public Arbiter(SequentialImpulsesSolver parent, Body body1, Body body2) { if (body1.ID < body2.ID) { this.body1 = body1; this.body2 = body2; } else { this.body1 = body2; this.body2 = body1; } this.tag1 = (SequentialImpulsesTag)this.body1.SolverTag; this.tag2 = (SequentialImpulsesTag)this.body2.SolverTag; this.circle1 = this.body1.Shape as CircleShape; this.circle2 = this.body2.Shape as CircleShape; this.friction = MathHelper.Sqrt( this.body1.Coefficients.DynamicFriction * this.body2.Coefficients.DynamicFriction); this.restitution = Math.Min(body1.Coefficients.Restitution, body2.Coefficients.Restitution); this.parent = parent; this.contacts = new LinkedList<ContactPoint>(); this.lastUpdate = -1; this.state = ContactState.New; this.ignoresCollisionResponse = body1.IgnoresCollisionResponse || body2.IgnoresCollisionResponse; }
/// <summary> /// Raises the <see cref="E:Added"/> event. /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void OnAdded(EventArgs e) { solver = (SequentialImpulsesSolver)Engine.Solver; base.OnAdded(e); }