예제 #1
0
파일: Test.cs 프로젝트: RubisetCie/box2c
 public override void PostSolve(Contact contact, ContactImpulse impulse)
 {
 }
예제 #2
0
 void PostSolveInternal(IntPtr contact, ContactImpulse impulse)
 {
     PostSolve(Contact.FromPtr(contact), impulse);
 }
예제 #3
0
 public abstract void PostSolve(Contact contact, ContactImpulse impulse);
예제 #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);
                }
            }
        }
예제 #5
0
 public abstract void PostSolve(Contact contact, ContactImpulse impulse);
예제 #6
0
 void PostSolveInternal(IntPtr contact, ContactImpulse impulse)
 {
     PostSolve(Contact.FromPtr(contact), impulse);
 }