Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 public void PostSolve(Contact contact, ContactImpulse impulse)
 {
     //eh
 }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 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);
 }