Example #1
0
 public void setDirtsActive(boolean dirtsActive) {
   this.dirtsActive = dirtsActive;
   for (Fixture fixture : dirts) {
     // fixture.setSensor(dirtsActive);
     fixture.getBody().setActive(dirtsActive);
   }
 }
Example #2
0
  private Body addFinish(World world, Vector2 position) {
    final BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyDef.BodyType.StaticBody;
    final Body body = world.createBody(bodyDef);
    body.setTransform(position.x + offset.x, position.y + offset.y, 0);

    final PolygonShape shape = new PolygonShape();
    shape.setAsBox(0.1f, 0.1f);
    final FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.shape = shape;
    fixtureDef.isSensor = true;
    final Fixture fixture = body.createFixture(fixtureDef);
    fixture.setUserData("finish");
    shape.dispose();
    return body;
  }