/// Set the contact filtering data. This is an expensive operation and should /// not be called frequently. This will not update contacts until the next time /// step when either parent body is awake. public void SetFilterData(ref Filter filter) { _filter = filter; if (_body == null) { return; } // Flag associated contacts for filtering. ContactEdge edge = _body.GetConactList(); while (edge != null) { Contact contact = edge.Contact; Fixture fixtureA = contact.GetFixtureA(); Fixture fixtureB = contact.GetFixtureB(); if (fixtureA == this || fixtureB == this) { contact.FlagForFiltering(); } } }
// We need separation create/destroy functions from the ructor/destructor because // the destructor cannot access the allocator or broad-phase (no destructor arguments allowed by C++). internal void Create(BroadPhase broadPhase, Body body, ref XForm xf, FixtureDef def) { _userData = def.userData; _friction = def.friction; _restitution = def.restitution; _density = def.density; _body = body; _next = null; _filter = def.filter; _isSensor = def.isSensor; _shape = def.shape.Clone(); // Create proxy in the broad-phase. AABB aabb; _shape.ComputeAABB(out aabb, ref xf); _proxyId = broadPhase.CreateProxy(ref aabb, this); }
/// Get the contact filtering data. public void GetFilterData(out Filter filter) { filter = _filter; }