Skip to content

Commit

Permalink
Add radius and position as optional parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ufrshubham committed Jul 13, 2024
1 parent 36d109f commit f894f4d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/forge2d/lib/src/collision/shapes/circle_shape.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import 'package:forge2d/src/settings.dart' as settings;
class CircleShape extends Shape {
final Vector2 position = Vector2.zero();

CircleShape() : super(ShapeType.circle) {
radius = 0.0;
CircleShape({
double radius = 0.0,
Vector2? position,
}) : super(ShapeType.circle) {
this.radius = radius;
if (position != null) {
this.position.setFrom(position);
}
}

@override
Shape clone() {
final shape = CircleShape();
shape.position.x = position.x;
shape.position.y = position.y;
shape.radius = radius;
return shape;
}
Shape clone() => CircleShape(radius: radius, position: position);

@override
int get childCount => 1;
Expand Down

0 comments on commit f894f4d

Please sign in to comment.