Пример #1
0
        public override void PreSolve(Contact contact, Manifold oldManifold)
        {
            Manifold manifold = contact.Manifold;

            if (manifold.PointCount == 0)
            {
                return;
            }

            Fixture fixtureA = contact.FixtureA;
            Fixture fixtureB = contact.FixtureB;

            PointState[] state1 = new PointState[Box2DSettings.b2_maxManifoldPoints],
            state2 = new PointState[Box2DSettings.b2_maxManifoldPoints];
            Manifold.GetPointStates(ref state1, ref state2, ref oldManifold, ref manifold);

            WorldManifold worldManifold = contact.WorldManifold;

            for (int i = 0; i < manifold.PointCount && m_pointCount < ContactPoint.k_maxContactPoints; ++i)
            {
                m_points[m_pointCount].fixtureA = fixtureA;
                m_points[m_pointCount].fixtureB = fixtureB;
                m_points[m_pointCount].position = worldManifold.Points[i];
                m_points[m_pointCount].normal   = worldManifold.Normal;
                m_points[m_pointCount].state    = state2[i];
                ++m_pointCount;
            }
        }