shouldCollide method

bool shouldCollide(
  1. Fixture fixtureA,
  2. Fixture fixtureB
)

Return true if contact calculations should be performed between these two shapes.

Warning: for performance reasons this is only called when the AABBs begin to overlap.

Implementation

bool shouldCollide(Fixture fixtureA, Fixture fixtureB) {
  final filterA = fixtureA.filterData;
  final filterB = fixtureB.filterData;

  if (filterA.groupIndex == filterB.groupIndex && filterA.groupIndex != 0) {
    return filterA.groupIndex > 0;
  }

  return ((filterA.maskBits & filterB.categoryBits) != 0) &&
      ((filterA.categoryBits & filterB.maskBits) != 0);
}