onCollision method

  1. @override
  2. @mustCallSuper
void onCollision(
  1. Set<Vector2> intersectionPoints,
  2. ShapeHitbox other
)
override

onCollision is called in every tick when this object is colliding with other.

Implementation

@override
@mustCallSuper
void onCollision(Set<Vector2> intersectionPoints, ShapeHitbox other) {
  onCollisionCallback?.call(intersectionPoints, other);
  if (hitboxParent is CollisionCallbacks &&
      triggersParentCollision &&
      other.triggersParentCollision) {
    (hitboxParent as CollisionCallbacks).onCollision(
      intersectionPoints,
      other.hitboxParent,
    );
  }
}