|
|
|
@ -19,37 +19,37 @@ class Baseboard extends BodyComponent with InitialPosition {
|
|
|
|
|
List<FixtureDef> _createFixtureDefs() {
|
|
|
|
|
final fixturesDef = <FixtureDef>[];
|
|
|
|
|
final direction = _side.direction;
|
|
|
|
|
final arcsAngle = -1.11 * direction;
|
|
|
|
|
const arcsRotation = math.pi / 2.08;
|
|
|
|
|
const arcsAngle = 1.11;
|
|
|
|
|
final arcsRotation = (_side.isLeft) ? -2.7 : -1.6;
|
|
|
|
|
|
|
|
|
|
final pegBumperShape = CircleShape()..radius = 0.7;
|
|
|
|
|
pegBumperShape.position.setValues(11.11 * direction, 7.15);
|
|
|
|
|
pegBumperShape.position.setValues(11.11 * direction, -7.15);
|
|
|
|
|
final pegBumperFixtureDef = FixtureDef(pegBumperShape);
|
|
|
|
|
fixturesDef.add(pegBumperFixtureDef);
|
|
|
|
|
|
|
|
|
|
final topCircleShape = CircleShape()..radius = 0.7;
|
|
|
|
|
topCircleShape.position.setValues(9.71 * direction, 4.95);
|
|
|
|
|
topCircleShape.position.setValues(9.71 * direction, -4.95);
|
|
|
|
|
final topCircleFixtureDef = FixtureDef(topCircleShape);
|
|
|
|
|
fixturesDef.add(topCircleFixtureDef);
|
|
|
|
|
|
|
|
|
|
final innerEdgeShape = EdgeShape()
|
|
|
|
|
..set(
|
|
|
|
|
Vector2(9.01 * direction, 5.35),
|
|
|
|
|
Vector2(5.29 * direction, -0.95),
|
|
|
|
|
Vector2(9.01 * direction, -5.35),
|
|
|
|
|
Vector2(5.29 * direction, 0.95),
|
|
|
|
|
);
|
|
|
|
|
final innerEdgeShapeFixtureDef = FixtureDef(innerEdgeShape);
|
|
|
|
|
fixturesDef.add(innerEdgeShapeFixtureDef);
|
|
|
|
|
|
|
|
|
|
final outerEdgeShape = EdgeShape()
|
|
|
|
|
..set(
|
|
|
|
|
Vector2(10.41 * direction, 4.75),
|
|
|
|
|
Vector2(3.79 * direction, -5.95),
|
|
|
|
|
Vector2(10.41 * direction, -4.75),
|
|
|
|
|
Vector2(3.79 * direction, 5.95),
|
|
|
|
|
);
|
|
|
|
|
final outerEdgeShapeFixtureDef = FixtureDef(outerEdgeShape);
|
|
|
|
|
fixturesDef.add(outerEdgeShapeFixtureDef);
|
|
|
|
|
|
|
|
|
|
final upperArcShape = ArcShape(
|
|
|
|
|
center: Vector2(0.09 * direction, 2.15),
|
|
|
|
|
center: Vector2(0.09 * direction, -2.15),
|
|
|
|
|
arcRadius: 6.1,
|
|
|
|
|
angle: arcsAngle,
|
|
|
|
|
rotation: arcsRotation,
|
|
|
|
@ -58,7 +58,7 @@ class Baseboard extends BodyComponent with InitialPosition {
|
|
|
|
|
fixturesDef.add(upperArcFixtureDef);
|
|
|
|
|
|
|
|
|
|
final lowerArcShape = ArcShape(
|
|
|
|
|
center: Vector2(0.09 * direction, -3.35),
|
|
|
|
|
center: Vector2(0.09 * direction, 3.35),
|
|
|
|
|
arcRadius: 4.5,
|
|
|
|
|
angle: arcsAngle,
|
|
|
|
|
rotation: arcsRotation,
|
|
|
|
@ -70,7 +70,7 @@ class Baseboard extends BodyComponent with InitialPosition {
|
|
|
|
|
..setAsBox(
|
|
|
|
|
6.8,
|
|
|
|
|
2,
|
|
|
|
|
Vector2(-6.3 * direction, -5.85),
|
|
|
|
|
Vector2(-6.3 * direction, 5.85),
|
|
|
|
|
0,
|
|
|
|
|
);
|
|
|
|
|
final bottomRectangleFixtureDef = FixtureDef(bottomRectangle);
|
|
|
|
@ -92,7 +92,7 @@ class Baseboard extends BodyComponent with InitialPosition {
|
|
|
|
|
|
|
|
|
|
final bodyDef = BodyDef()
|
|
|
|
|
..position = initialPosition
|
|
|
|
|
..angle = _side.isLeft ? -angle : angle;
|
|
|
|
|
..angle = _side.isLeft ? angle : -angle;
|
|
|
|
|
|
|
|
|
|
final body = world.createBody(bodyDef);
|
|
|
|
|
_createFixtureDefs().forEach(body.createFixture);
|
|
|
|
|