Ejemplo n.º 1
0
        private void PostSolve(Contact contact, ref ContactImpulse impulse)
        {
            if (!Broken)
            {
                if (Parts.Contains(contact.FixtureA) || Parts.Contains(contact.FixtureB))
                {
                    float maxImpulse = 0.0f;
                    int   count      = contact.Manifold.PointCount;

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

                    if (maxImpulse > Strength)
                    {
                        // Flag the body for breaking.
                        _break = true;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void Report(ContactConstraint[] constraints)
        {
            if (_contactManager == 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;
                }

                _contactManager.PostSolve(c, ref impulse);
            }
        }
Ejemplo n.º 3
0
        private void Report(ContactConstraint[] constraints)
        {
            if (_contactManager == 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;
                }

                _contactManager.PostSolve(c, ref impulse);
            }
        }