Esempio n. 1
0
        /// Evaluate this contact with your own manifold and transforms.
        public void Evaluate(b2Manifold manifold, ref b2Transform xfA, ref b2Transform xfB)
        {
            switch (_type)
            {
            case ContactType.b2CircleContact:
                b2Collision.b2CollideCircles(manifold, (b2CircleShape)FixtureA.Shape, ref xfA,
                                             (b2CircleShape)FixtureB.Shape, ref xfB);
                break;

            case ContactType.b2PolygonAndCircleContact:
                b2Collision.b2CollidePolygonAndCircle(manifold, (b2PolygonShape)FixtureA.Shape, ref xfA,
                                                      (b2CircleShape)FixtureB.Shape, ref xfB);
                break;

            case ContactType.b2PolygonContact:
                b2Collision.b2CollidePolygons(manifold, (b2PolygonShape)FixtureA.Shape, ref xfA,
                                              (b2PolygonShape)FixtureB.Shape, ref xfB);
                break;

            case ContactType.b2EdgeAndCircleContact:
                b2Collision.b2CollideEdgeAndCircle(manifold, (b2EdgeShape)FixtureA.Shape, ref xfA,
                                                   (b2CircleShape)FixtureB.Shape, ref xfB);
                break;

            case ContactType.b2EdgeAndPolygonContact:
                b2Collision.b2CollideEdgeAndPolygon(manifold, (b2EdgeShape)FixtureA.Shape, ref xfA,
                                                    (b2PolygonShape)FixtureB.Shape, ref xfB);
                break;

            case ContactType.b2ChainAndCircleContact:
                b2ChainShape chain = (b2ChainShape)FixtureA.Shape;
                b2EdgeShape  edge;
                edge = chain.GetChildEdge(m_indexA);
                b2Collision.b2CollideEdgeAndCircle(manifold, edge, ref xfA, (b2CircleShape)FixtureB.Shape,
                                                   ref xfB);
                break;

            case ContactType.b2ChainAndPolygonContact:
                chain = (b2ChainShape)FixtureA.Shape;
                edge  = chain.GetChildEdge(m_indexA);
                b2Collision.b2CollideEdgeAndPolygon(manifold, edge, ref xfA, (b2PolygonShape)FixtureB.Shape,
                                                    ref xfB);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
    public override void Evaluate(b2Manifold manifold, b2Transform xfA, b2Transform xfB)
    {
        b2ChainShape chain = (b2ChainShape)m_fixtureA.GetShape();
        b2EdgeShape  edge  = new b2EdgeShape();

        chain.GetChildEdge(edge, m_indexA);
        Utils.b2CollideEdgeAndPolygon(manifold, edge, xfA, (b2PolygonShape)m_fixtureB.GetShape(), xfB);
    }
Esempio n. 3
0
        public override void Evaluate(ref b2Manifold manifold, ref b2Transform xfA, ref b2Transform xfB)
        {
            b2ChainShape chain = (b2ChainShape)m_fixtureA.Shape;
            b2EdgeShape  edge;

            edge = chain.GetChildEdge(m_indexA);
            b2Collision.b2CollideEdgeAndPolygon(ref manifold, edge, ref xfA,
                                                (b2PolygonShape)m_fixtureB.Shape, ref xfB);
        }