possiblyOverlapping method

bool possiblyOverlapping(
  1. HasHitboxes other
)

Since this is a cheaper calculation than checking towards all shapes, this check can be done first to see if it even is possible that the shapes can overlap, since the shapes have to be within the size of the component.

Implementation

bool possiblyOverlapping(HasHitboxes other) {
  final maxDistance = other.scaledSize.length + scaledSize.length;
  return other.absoluteCenter.distanceToSquared(absoluteCenter) <=
      maxDistance * maxDistance;
}