diff --git a/packages/flame/lib/src/collisions/hitboxes/rectangle_hitbox.dart b/packages/flame/lib/src/collisions/hitboxes/rectangle_hitbox.dart index 4a6ee90e895..f8acb2b124f 100644 --- a/packages/flame/lib/src/collisions/hitboxes/rectangle_hitbox.dart +++ b/packages/flame/lib/src/collisions/hitboxes/rectangle_hitbox.dart @@ -38,6 +38,7 @@ class RectangleHitbox extends RectangleComponent with ShapeHitbox { parentSize: parentSize, angle: angle, anchor: anchor, + shrinkToBounds: true, ); @override diff --git a/packages/flame/lib/src/geometry/rectangle_component.dart b/packages/flame/lib/src/geometry/rectangle_component.dart index 61820688d32..eeab00d62e7 100644 --- a/packages/flame/lib/src/geometry/rectangle_component.dart +++ b/packages/flame/lib/src/geometry/rectangle_component.dart @@ -47,10 +47,14 @@ class RectangleComponent extends PolygonComponent { /// [parentSize]. RectangleComponent.relative( Vector2 relation, { - Vector2? position, required Vector2 parentSize, - double angle = 0, + Vector2? position, + Vector2? scale, + double? angle = 0, Anchor? anchor, + int? priority, + Paint? paint, + bool? shrinkToBounds, }) : super.relative( [ relation.clone(), @@ -59,9 +63,13 @@ class RectangleComponent extends PolygonComponent { Vector2(-relation.x, relation.y), ], position: position, + scale: scale, parentSize: parentSize, angle: angle, anchor: anchor, + priority: priority, + paint: paint, + shrinkToBounds: shrinkToBounds, ); /// This factory will create a [RectangleComponent] from a positioned [Rect].