createBody method

  1. @override
Body createBody()
override

You should create the Forge2D Body in this method when you extend the BodyComponent.

Implementation

@override
Body createBody() {
  final bodyDef = BodyDef(type: BodyType.static);
  final shape = PolygonShape()..set(pointList);
  final fixtureDef = FixtureDef(shape);
  return world.createBody(bodyDef)..createFixture(fixtureDef);
}