public virtual void Refilter() { if (m_body == null) { return; } // Flag associated contacts for filtering. b2ContactEdge edge = m_body.ContactList; while (edge != null) { b2Contact contact = edge.Contact; b2Fixture fixtureA = contact.GetFixtureA(); b2Fixture fixtureB = contact.GetFixtureB(); if (fixtureA == this || fixtureB == this) { contact.FlagForFiltering(); } edge = edge.Next; } b2World world = m_body.World; if (world == null) { return; } // Touch each proxy so that new pairs may be created b2BroadPhase broadPhase = world.ContactManager.BroadPhase; for (int i = 0; i < m_proxyCount; ++i) { broadPhase.TouchProxy(m_proxies[i].proxyId); } }
/** * Set the contact filtering data. This will not update contacts until the next time * step when either parent body is active and awake. */ public void SetFilterData(b2FilterData filter) { m_filter = filter.Copy(); if (m_body != null) { return; } b2ContactEdge edge = m_body.GetContactList(); while (edge != null) { b2Contact contact = edge.contact; b2Fixture fixtureA = contact.GetFixtureA(); b2Fixture fixtureB = contact.GetFixtureB(); if (fixtureA == this || fixtureB == this) { contact.FlagForFiltering(); } edge = edge.next; } }