public override void PostSolve(Contact contact, ContactImpulse impulse)
        {
            if (_broke)
            {
                // The body already broke.
                return;
            }

            // Should the body break?
            int count = contact.GetManifold().PointCount;

            float maxImpulse = 0.0f;
            for (int i = 0; i < count; ++i)
            {
                maxImpulse = Math.Max(maxImpulse, impulse.normalImpulses[i]);
            }

            if (maxImpulse > 50.0f)
            {
                // Flag the body for breaking.
                _break = true;
            }
        }
 public void PostSolve(Contact contact, ContactImpulse impulse)
 {
     //eh
 }
 /// This lets you inspect a contact after the solver is finished. This is useful
 /// for inspecting impulses.
 /// Note: the contact manifold does not include time of impact impulses, which can be
 /// arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly
 /// in a separate data structure.
 /// Note: this is only called for contacts that are touching, solid, and awake.
 public virtual void PostSolve(Contact contact, ContactImpulse impulse)
 {
     //B2_NOT_USED(contact);
     //B2_NOT_USED(impulse);
 }
        public void Report(ContactConstraint[] constraints)
        {
            if (_listener == null)
            {
                return;
            }

            for (int i = 0; i < _contactCount; ++i)
            {
                Contact c = _contacts[i];
                ContactConstraint cc = constraints[i];
                ContactImpulse impulse = new ContactImpulse();
                for (int j = 0; j < cc.PointCount; ++j)
                {
                    impulse.normalImpulses[j] = cc.Points[j].NormalImpulse;
                    impulse.tangentImpulses[j] = cc.Points[j].TangentImpulse;
                }

                _listener.PostSolve(c, impulse);
            }
        }
Exemple #5
0
 /// This lets you inspect a contact after the solver is finished. This is useful
 /// for inspecting impulses.
 /// Note: the contact manifold does not include time of impact impulses, which can be
 /// arbitrarily large if the sub-step is small. Hence the impulse is provided explicitly
 /// in a separate data structure.
 /// Note: this is only called for contacts that are touching, solid, and awake.
 public virtual void PostSolve(Contact contact, ContactImpulse impulse)
 {
     //B2_NOT_USED(contact);
     //B2_NOT_USED(impulse);
 }