verifyCollisionSimulate method

bool verifyCollisionSimulate(
  1. Vector2 position,
  2. CollisionArea other
)

Implementation

bool verifyCollisionSimulate(Vector2 position, CollisionArea other) {
  Shape? shapeAux;
  if (shape is CircleShape) {
    shapeAux = CircleShape(
      (shape as CircleShape).radius,
    );
  } else if (shape is RectangleShape) {
    shapeAux = RectangleShape(
      Vector2(
        (shape as RectangleShape).rect.width,
        (shape as RectangleShape).rect.height,
      ),
    );
  } else if (shape is PolygonShape) {
    shapeAux = PolygonShape(
      (shape as PolygonShape).relativePoints,
    );
  }

  shapeAux?.position = Vector2(
    position.x + (align?.x ?? 0.0),
    position.y + (align?.y ?? 0.0),
  );
  return shapeAux?.isCollision(other.shape) ?? false;
}