Esempio n. 1
0
        /// <summary>
        /// Call this if you want to establish collision that was previously disabled by
        /// ContactFilter::ShouldCollide.
        /// </summary>
        public void Refilter()
        {
            if (Body == null)
            {
                return;
            }

            // Flag associated contacts for filtering.
            ContactEdge edge = Body.ContactList;

            while (edge != null)
            {
                Contact contact  = edge.Contact;
                Fixture fixtureA = contact.FixtureA;
                Fixture fixtureB = contact.FixtureB;
                if (fixtureA == this || fixtureB == this)
                {
                    contact.SetFlagForFiltering();
                }
                edge = edge.Next;
            }

            World world = Body.World;

            if (world == null)
            {
                return;
            }

            // Touch each proxy so that new pairs may be created
            BroadPhase broadPhase = world.ContactManager.BroadPhase;

            for (int i = 0; i < ProxyCount; ++i)
            {
                broadPhase.TouchProxy(Proxies[i].ProxyId);
            }
        }