Пример #1
0
        public static void CollidePolygonAndCircle(out Manifold manifold, PolygonShape polygon, Transform xf1, CircleShape circle, Transform xf2)
        {
            var polyLock = polygon.Lock();
            var circleLock = circle.Lock();

            NativeMethods.cb2_collidepolygonandcircle(out manifold, polyLock, xf1, circleLock, xf2);

            polygon.Unlock();
            circle.Unlock();
        }
Пример #2
0
        public static void CollidePolygons(out Manifold manifold, PolygonShape poly1, Transform xf1, PolygonShape poly2, Transform xf2)
        {
            var poly1Lock = poly1.Lock();
            var poly2Lock = poly2.Lock();

            NativeMethods.cb2_collidepolygons(out manifold, poly1Lock, xf1, poly2Lock, xf2);

            poly1.Unlock();
            poly2.Unlock();
        }
Пример #3
0
        public static void CollideCircles(out Manifold manifold, CircleShape circle1, Transform xf1, CircleShape circle2, Transform xf2)
        {
            var circle1Lock = circle1.Lock();
            var circle2Lock = circle2.Lock();

            NativeMethods.cb2_collidecircles(out manifold, circle1Lock, xf1, circle2Lock, xf2);

            circle1.Unlock();
            circle2.Unlock();
        }
Пример #4
0
        public override void PreSolve(Contact contact, Manifold oldManifold)
        {
            base.PreSolve(contact, oldManifold);

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

            if (fixtureA != m_platform && fixtureA != m_character)
                return;

            if (fixtureB != m_character && fixtureB != m_character)
                return;

            Vec2 position = m_character.Body.Position;

            if (position.Y < m_top + m_radius - 3.0f * Box2DSettings.b2_linearSlop)
                contact.Enabled = false;
        }
Пример #5
0
 public static extern void b2contact_evaluate(IntPtr contact, out Manifold outManifold, Transform xfA, Transform xfB);
Пример #6
0
        public void Evaluate(out Manifold manifold, Transform xfA, Transform xfB)
        {
            manifold = new Manifold();

            NativeMethods.b2contact_evaluate(_contactPtr, out manifold, xfA, xfB);
        }
Пример #7
0
 void PreSolveInternal(IntPtr contact, Manifold oldManifold)
 {
     PreSolve(Contact.FromPtr(contact), oldManifold);
 }
Пример #8
0
 public static extern void cb2_collidecircles(out Manifold manifold, IntPtr circle1, Transform xf1, IntPtr circle2, Transform xf2);
Пример #9
0
 public abstract void PreSolve(Contact contact, Manifold oldManifold);
Пример #10
0
 void PreSolveInternal(IntPtr contact, Manifold oldManifold)
 {
     PreSolve(Contact.FromPtr(contact), oldManifold);
 }
Пример #11
0
 public static extern void cb2_collidepolygons(out Manifold manifold, IntPtr polygon1, Transform xf1, IntPtr polygon2, Transform xf2);
Пример #12
0
 public static extern void cb2_collidepolygonandcircle(out Manifold manifold, IntPtr polygon, Transform xf1, IntPtr circle, Transform xf2);
Пример #13
0
 public static extern void cb2_collidecircles(out Manifold manifold, IntPtr circle1, Transform xf1, IntPtr circle2, Transform xf2);
Пример #14
0
 public static extern void b2contact_getmanifold(IntPtr contact, out Manifold manifold);
Пример #15
0
 public static extern void cb2_collidepolygonandcircle(out Manifold manifold, IntPtr polygon, Transform xf1, IntPtr circle, Transform xf2);
Пример #16
0
        public static void GetPointStates(ref PointState[] state1, ref PointState[] state2,
            ref Manifold manifold1, ref Manifold manifold2)
        {
            for (int i = 0; i < Box2DSettings.b2_maxManifoldPoints; ++i)
            {
                state1[i] = PointState.Null;
                state2[i] = PointState.Null;
            }

            // Detect persists and removes.
            for (int i = 0; i < manifold1.PointCount; ++i)
            {
                ContactID id = manifold1[i].ID;

                state1[i] = PointState.Remove;

                for (int j = 0; j < manifold2.PointCount; ++j)
                {
                    if (manifold2[j].ID.Key == id.Key)
                    {
                        state1[i] = PointState.Persist;
                        break;
                    }
                }
            }

            // Detect persists and adds.
            for (int i = 0; i < manifold2.PointCount; ++i)
            {
                ContactID id = manifold2[i].ID;

                state2[i] = PointState.Add;

                for (int j = 0; j < manifold1.PointCount; ++j)
                {
                    if (manifold1[j].ID.Key == id.Key)
                    {
                        state2[i] = PointState.Persist;
                        break;
                    }
                }
            }
        }
Пример #17
0
 public static extern void cb2_collidepolygons(out Manifold manifold, IntPtr polygon1, Transform xf1, IntPtr polygon2, Transform xf2);
Пример #18
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;
            }
        }
Пример #19
0
 public abstract void PreSolve(Contact contact, Manifold oldManifold);