Пример #1
0
  public void initWorld() {
    Vec2 gravity = new Vec2(0.0f, 9.8f);
    world = new World(gravity);

    // ground
    FixtureDef groundFixtureDef = new FixtureDef();
    PolygonShape groundShape = new PolygonShape();
    groundShape.setAsBox(20f, 0.1f);
    groundFixtureDef.shape = groundShape;
    groundFixtureDef.density = 25.0f;
    groundFixtureDef.filter = new Filter();
    groundFixtureDef.filter.categoryBits = 0x0001;

    BodyDef groundBodyDef = new BodyDef();
    groundBodyDef.position = new Vec2(0.0f, 3f);
    groundBodyDef.angle = 0.0f;
    groundBodyDef.type = BodyType.STATIC;

    groundBody = world.createBody(groundBodyDef);
    groundFixture = groundBody.createFixture(groundFixtureDef);
  }