onCollisionStart method

  1. @override
void onCollisionStart(
  1. Set<Vector2> intersectionPoints,
  2. PositionComponent other
)

onCollisionStart is called in the first tick when this object starts colliding with other.

Implementation

@override
void onCollisionStart(
  Set<Vector2> intersectionPoints,
  PositionComponent other,
) {
  activeCollisions.add(other);
  final otherEntity = _findEntity(other);
  if (otherEntity == null) {
    return;
  }

  for (final behavior in _propagateToBehaviors) {
    if (behavior.isValid(otherEntity)) {
      behavior.onCollisionStart(intersectionPoints, otherEntity);
    }
  }
  return super.onCollisionStart(intersectionPoints, other);
}