/// <summary> /// Return true if contact calculations should be performed between these two shapes. /// If you implement your own collision filter you may want to build from this implementation. /// @warning for performance reasons this is only called when the AABBs begin to overlap. /// </summary> public virtual bool ShouldCollide(Fixture fixtureA, Fixture fixtureB) { Filter filter1 = fixtureA.GetFilterData(); Filter filter2 = fixtureB.GetFilterData(); if (filter1.GroupIndex == filter2.GroupIndex && filter1.GroupIndex != 0) { return(filter1.GroupIndex > 0); } bool collide = (filter1.MaskBits & filter2.CategoryBits) != 0 && (filter1.CategoryBits & filter2.MaskBits) != 0; return(collide); }
/// <summary> /// Return true if contact calculations should be performed between these two shapes. /// If you implement your own collision filter you may want to build from this implementation. /// @warning for performance reasons this is only called when the AABBs begin to overlap. /// </summary> public virtual bool ShouldCollide(Fixture fixtureA, Fixture fixtureB) { Filter filter1 = fixtureA.GetFilterData(); Filter filter2 = fixtureB.GetFilterData(); if (filter1.GroupIndex == filter2.GroupIndex && filter1.GroupIndex != 0) { return filter1.GroupIndex > 0; } bool collide = (filter1.MaskBits & filter2.CategoryBits) != 0 && (filter1.CategoryBits & filter2.MaskBits) != 0; return collide; }