Example #1
0
 public override void PostSolve(Contact contact, ContactImpulse impulse)
 {
 }
Example #2
0
 void PostSolveInternal(IntPtr contact, ContactImpulse impulse)
 {
     PostSolve(Contact.FromPtr(contact), impulse);
 }
Example #3
0
 public abstract void PostSolve(Contact contact, ContactImpulse impulse);
Example #4
0
        public override void PostSolve(Contact contact, ContactImpulse impulse)
        {
            foreach (var x in m_breaks)
            {
                if (_jointsToRemove.Contains(x) || x.MaxForce == 0)
                {
                    // The body already broke.
                    continue;
                }

                bool hasAnyFixtures = false;

                foreach (var f in x.Joint.BodyA.Fixtures)
                {
                    if (f == contact.FixtureA || f == contact.FixtureB)
                    {
                        hasAnyFixtures = true;
                        break;
                    }
                }

                if (!hasAnyFixtures)
                {
                    foreach (var f in x.Joint.BodyB.Fixtures)
                    {
                        if (f == contact.FixtureA || f == contact.FixtureB)
                        {
                            hasAnyFixtures = true;
                            break;
                        }
                    }

                    if (!hasAnyFixtures)
                        continue;
                }

                // Should the body break?
                int count = contact.Manifold.PointCount;

                float maxImpulse = 0.0f;
                for (int i = 0; i < count; ++i)
                    maxImpulse = Math.Max(maxImpulse, impulse.GetNormalImpulse(i));

                if (maxImpulse > x.MaxForce)
                {
                    // Flag the body for breaking.
                    _jointsToRemove.Add(x);
                }
            }
        }
Example #5
0
 public abstract void PostSolve(Contact contact, ContactImpulse impulse);
Example #6
0
 void PostSolveInternal(IntPtr contact, ContactImpulse impulse)
 {
     PostSolve(Contact.FromPtr(contact), impulse);
 }