collidedWithTheOther method

void collidedWithTheOther(
  1. Vector2 direction, [
  2. Duration duration = Durations.medium3
])

Implementation

void collidedWithTheOther(
  Vector2 direction, [
  Duration duration = Durations.medium3,
]) {
  Vector2 impulse = direction * collisionSpeed;
  collided = true;
  body.applyLinearImpulse(impulse, point: body.worldCenter);

  Future<void>.delayed(duration).then((_) {
    collided = false;
    _reposition();
  });
}