Package org.jbox2d.dynamics

Examples of org.jbox2d.dynamics.Body.createFixture()


      fd.shape = shape;
      fd.density = 0.0f;
      fd.friction = 0.6f;

      shape.set(new Vec2(-20.0f, 0.0f), new Vec2(20.0f, 0.0f));
      ground.createFixture(fd);

      float hs[] = {0.25f, 1.0f, 4.0f, 0.0f, 0.0f, -1.0f, -2.0f, -2.0f, -1.25f, 0.0f};

      float x = 20.0f, y1 = 0.0f, dx = 5.0f;
View Full Code Here


      float x = 20.0f, y1 = 0.0f, dx = 5.0f;

      for (int i = 0; i < 10; ++i) {
        float y2 = hs[i];
        shape.set(new Vec2(x, y1), new Vec2(x + dx, y2));
        ground.createFixture(fd);
        y1 = y2;
        x += dx;
      }

      for (int i = 0; i < 10; ++i) {
View Full Code Here

      }

      for (int i = 0; i < 10; ++i) {
        float y2 = hs[i];
        shape.set(new Vec2(x, y1), new Vec2(x + dx, y2));
        ground.createFixture(fd);
        y1 = y2;
        x += dx;
      }

      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
View Full Code Here

        y1 = y2;
        x += dx;
      }

      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
      ground.createFixture(fd);

      x += 80.0f;
      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
      ground.createFixture(fd);
View Full Code Here

      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
      ground.createFixture(fd);

      x += 80.0f;
      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
      ground.createFixture(fd);

      x += 40.0f;
      shape.set(new Vec2(x, 0.0f), new Vec2(x + 10.0f, 5.0f));
      ground.createFixture(fd);
View Full Code Here

      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
      ground.createFixture(fd);

      x += 40.0f;
      shape.set(new Vec2(x, 0.0f), new Vec2(x + 10.0f, 5.0f));
      ground.createFixture(fd);

      x += 20.0f;
      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
      ground.createFixture(fd);
View Full Code Here

      shape.set(new Vec2(x, 0.0f), new Vec2(x + 10.0f, 5.0f));
      ground.createFixture(fd);

      x += 20.0f;
      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
      ground.createFixture(fd);

      x += 40.0f;
      shape.set(new Vec2(x, 0.0f), new Vec2(x, 20.0f));
      ground.createFixture(fd);
    }
View Full Code Here

      shape.set(new Vec2(x, 0.0f), new Vec2(x + 40.0f, 0.0f));
      ground.createFixture(fd);

      x += 40.0f;
      shape.set(new Vec2(x, 0.0f), new Vec2(x, 20.0f));
      ground.createFixture(fd);
    }

    // Teeter
    {
      BodyDef bd = new BodyDef();
View Full Code Here

      bd.type = BodyType.DYNAMIC;
      Body body = m_world.createBody(bd);

      PolygonShape box = new PolygonShape();
      box.setAsBox(10.0f, 0.25f);
      body.createFixture(box, 1.0f);

      RevoluteJointDef jd = new RevoluteJointDef();
      jd.initialize(ground, body, body.getPosition());
      jd.lowerAngle = -8.0f * MathUtils.PI / 180.0f;
      jd.upperAngle = 8.0f * MathUtils.PI / 180.0f;
View Full Code Here

      for (int i = 0; i < N; ++i) {
        BodyDef bd = new BodyDef();
        bd.type = BodyType.DYNAMIC;
        bd.position.set(161.0f + 2.0f * i, -0.125f);
        Body body = m_world.createBody(bd);
        body.createFixture(fd);

        Vec2 anchor = new Vec2(160.0f + 2.0f * i, -0.125f);
        jd.initialize(prevBody, body, anchor);
        m_world.createJoint(jd);

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.