Examples of EdgeShape


Examples of org.jbox2d.collision.shapes.EdgeShape

      m_debugDraw.drawSolidPolygon(vertices, vertexCount, color);
    }
      break;
    case EDGE: {
      EdgeShape edge = (EdgeShape)fixture.getShape();
      Transform.mulToOutUnsafe(xf, edge.m_vertex1, v1);
      Transform.mulToOutUnsafe(xf, edge.m_vertex2, v2);
      m_debugDraw.drawSegment(v1, v2, color);
    }
      break;
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

    }
    {
      BodyDef bd = new BodyDef();
      Body ground = getWorld().createBody(bd);

      EdgeShape shape = new EdgeShape();

      // Floor
      shape.set(new Vec2(-10.0f, 0.0f), new Vec2(10.0f, 0.0f));
      ground.createFixture(shape, 0.0f);

      // Left wall
      shape.set(new Vec2(-10.0f, 0.0f), new Vec2(-10.0f, 20.0f));
      ground.createFixture(shape, 0.0f);

      // Right wall
      shape.set(new Vec2(10.0f, 0.0f), new Vec2(10.0f, 20.0f));
      ground.createFixture(shape, 0.0f);

      // Roof
      shape.set(new Vec2(-10.0f, 20.0f), new Vec2(10.0f, 20.0f));
      ground.createFixture(shape, 0.0f);
    }

    float radius = 0.5f;
    CircleShape shape = new CircleShape();
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

    {
      BodyDef bd = new BodyDef();
      bd.position.set(0.0f, 0.0f);
      Body body = getWorld().createBody(bd);

      EdgeShape shape = new EdgeShape();

      shape.set(new Vec2(-10.0f, 0.0f), new Vec2(10.0f, 0.0f));
      body.createFixture(shape, 0.0f);

      PolygonShape pshape = new PolygonShape();
      pshape.setAsBox(0.2f, 1.0f, new Vec2(0.5f, 1.0f), 0.0f);
      body.createFixture(pshape, 0.0f);
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

    {
      BodyDef bd = new BodyDef();
      bd.position.set(0.0f, 0.0f);
      Body body = m_world.createBody(bd);

      EdgeShape edge = new EdgeShape();

      edge.set(new Vec2(-10.0f, 0.0f), new Vec2(10.0f, 0.0f));
      body.createFixture(edge, 0.0f);

      PolygonShape shape = new PolygonShape();
      shape.setAsBox(0.2f, 1.0f, new Vec2(0.5f, 1.0f), 0.0f);
      body.createFixture(shape, 0.0f);
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

    int count = 20;
    {
      BodyDef bd = new BodyDef();
      Body ground = getWorld().createBody(bd);

      EdgeShape shape = new EdgeShape();
      shape.set(new Vec2(-40.0f, 0f), new Vec2(40.0f, 0f));
      ground.createFixture(shape, 0.0f);

    }

    {
      float a = .5f;
      PolygonShape shape = new PolygonShape();
      shape.setAsBox(a, a);

      Vec2 x = new Vec2(-7.0f, 0.75f);
      Vec2 y = new Vec2();
      Vec2 deltaX = new Vec2(0.5625f, 1.25f);
      Vec2 deltaY = new Vec2(1.125f, 0.0f);
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

    // Ground body
    {
      BodyDef bd = new BodyDef();
      Body ground = getWorld().createBody(bd);

      EdgeShape shape = new EdgeShape();
      shape.set(new Vec2(-40.0f, 0.0f), new Vec2(40.0f, 0.0f));
      ground.createFixture(shape, 0.0f);
    }

    // Breakable dynamic body
    {
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

    Body ground = null;
    {
      BodyDef bd = new BodyDef();
      ground = getWorld().createBody(bd);

      EdgeShape shape = new EdgeShape();
      shape.set(new Vec2(-40.0f, 0.0f), new Vec2(40.0f, 0.0f));
      ground.createFixture(shape, 0.0f);
    }

    {
      PolygonShape shape = new PolygonShape();
      shape.setAsBox(0.6f, 0.125f);

      FixtureDef fd = new FixtureDef();
      fd.shape = shape;
      fd.density = 20.0f;
      fd.friction = 0.2f;
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

      return;
    }
    // Ground
    {

      EdgeShape shape = new EdgeShape();
      shape.set(new Vec2(-20.0f, 0.0f), new Vec2(20.0f, 0.0f));
      getGroundBody().createFixture(shape, 0.0f);
    }

    // Platform
    {
      BodyDef bd = new BodyDef();
      bd.position.set(-5.0f, 5.0f);
      Body body = getWorld().createBody(bd);

      PolygonShape shape = new PolygonShape();
      shape.setAsBox(10.0f, 0.5f);

      FixtureDef fd = new FixtureDef();
      fd.shape = shape;
      fd.friction = 0.8f;
      m_platform = body.createFixture(fd);
    }

    // Boxes
    for (int i = 0; i < 5; ++i) {
      BodyDef bd = new BodyDef();
      bd.type = BodyType.DYNAMIC;
      bd.position.set(-10.0f + 2.0f * i, 7.0f);
      Body body = m_world.createBody(bd);

      PolygonShape shape = new PolygonShape();
      shape.setAsBox(0.5f, 0.5f);
      body.createFixture(shape, 20.0f);
    }
  }
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

      float y1 = 2.0f * MathUtils.cos(x1 / 10.0f * MathUtils.PI);
      for (int i = 0; i < 80; ++i) {
        float x2 = x1 + 0.5f;
        float y2 = 2.0f * MathUtils.cos(x2 / 10.0f * MathUtils.PI);

        EdgeShape shape = new EdgeShape();
        shape.set(new Vec2(x1, y1), new Vec2(x2, y2));
        ground.createFixture(shape, 0.0f);

        x1 = x2;
        y1 = y2;
      }
View Full Code Here

Examples of org.jbox2d.collision.shapes.EdgeShape

    Body ground = null;
    {
      BodyDef bd = new BodyDef();
      ground = getWorld().createBody(bd);

      EdgeShape shape = new EdgeShape();
      shape.set(new Vec2(-40.0f, 0.0f), new Vec2(40.0f, 0.0f));
      ground.createFixture(shape, 0.0f);
    }

    {
      PolygonShape shape = new PolygonShape();
      shape.setAsBox(2.0f, 0.5f);

      BodyDef bd = new BodyDef();
      bd.type = BodyType.DYNAMIC;
      bd.position.set(-10.0f, 10.0f);
      bd.angle = 0.5f * MathUtils.PI;
 
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.