Package com.badlogic.gdx.physics.box2d

Examples of com.badlogic.gdx.physics.box2d.FixtureDef


  public static FixtureDef createFixtureDef(final float pDensity, final float pElasticity, final float pFriction) {
    return PhysicsFactory.createFixtureDef(pDensity, pElasticity, pFriction, false);
  }

  public static FixtureDef createFixtureDef(final float pDensity, final float pElasticity, final float pFriction, final boolean pSensor) {
    final FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.density = pDensity;
    fixtureDef.restitution = pElasticity;
    fixtureDef.friction = pFriction;
    fixtureDef.isSensor = pSensor;
    return fixtureDef;
View Full Code Here


    fixtureDef.isSensor = pSensor;
    return fixtureDef;
  }

  public static FixtureDef createFixtureDef(final float pDensity, final float pElasticity, final float pFriction, final boolean pSensor, final short pCategoryBits, final short pMaskBits, final short pGroupIndex) {
    final FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.density = pDensity;
    fixtureDef.restitution = pElasticity;
    fixtureDef.friction = pFriction;
    fixtureDef.isSensor = pSensor;
    final Filter filter = fixtureDef.filter;
View Full Code Here

  private void createBoxes() {
    CircleShape ballShape = new CircleShape();
    ballShape.setRadius(RADIUS);

    FixtureDef def = new FixtureDef();
    def.restitution = 0.9f;
    def.friction = 0.01f;
    def.shape = ballShape;
    def.density = 1f;
    BodyDef boxBodyDef = new BodyDef();
View Full Code Here

        unit.setBody (world.createBody(bodyDef));

        CircleShape circle = new CircleShape();
        circle.setRadius(64f * Detonator.WORLD_TO_BOX2D);

        FixtureDef fixtureDef = new FixtureDef();
        fixtureDef.shape = circle;
        fixtureDef.density = 0.2f;
        fixtureDef.friction = 0.4f;
        fixtureDef.restitution = 0.67f;

View Full Code Here

      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(45f  , -50f  );
        vertices[1] = new Vector2(50f , -50f  );
        vertices[2] = new Vector2(50f , 50f);
        vertices[3] = new Vector2(45f , 50f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(50f  , -40f  );
        vertices[1] = new Vector2(50f , -35f  );
        vertices[2] = new Vector2(-50f , -35f);
        vertices[3] = new Vector2(-50f , -40f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(50f  , 55f  );
        vertices[1] = new Vector2(50f , 60f  );
        vertices[2] = new Vector2(-50f , 60f);
        vertices[3] = new Vector2(-50f , 55f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(60f  , 0f  );
        vertices[1] = new Vector2(70f , 20f  );
        vertices[2] = new Vector2(0f , -55);
        vertices[3] = new Vector2(5f , -75f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(80f  , 0f  );
        vertices[1] = new Vector2(90f , 10f  );
        vertices[2] = new Vector2(0f , 85);
        vertices[3] = new Vector2(5f , 68f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(0f  , -60f  );
        vertices[1] = new Vector2(-50f , 0f  );
        vertices[2] = new Vector2(-60f , 0);
        vertices[3] = new Vector2(-10f , -60f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(0f  , 75f  );
        vertices[1] = new Vector2(-65f , 30f  );
        vertices[2] = new Vector2(-50f , 30);
        vertices[3] = new Vector2(10f , 75f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
View Full Code Here

    // finally we add a fixture to the body using the polygon
    // defined above. Note that we have to dispose PolygonShapes
    // and CircleShapes once they are no longer used. This is the
    // only time you have to care explicitely for memomry managment.
    FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.shape = groundPoly;
    fixtureDef.filter.groupIndex = 0;
    groundBody.createFixture(fixtureDef);
    groundPoly.dispose();
View Full Code Here

      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(45f  , -50f  );
        vertices[1] = new Vector2(50f , -50f  );
        vertices[2] = new Vector2(50f , 50f);
        vertices[3] = new Vector2(45f , 50f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(50f  , -40f  );
        vertices[1] = new Vector2(50f , -35f  );
        vertices[2] = new Vector2(-50f , -35f);
        vertices[3] = new Vector2(-50f , -40f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(50f  , 55f  );
        vertices[1] = new Vector2(50f , 60f  );
        vertices[2] = new Vector2(-50f , 60f);
        vertices[3] = new Vector2(-50f , 55f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(60f  , 0f  );
        vertices[1] = new Vector2(70f , 20f  );
        vertices[2] = new Vector2(0f , -55);
        vertices[3] = new Vector2(5f , -75f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(80f  , 0f  );
        vertices[1] = new Vector2(90f , 10f  );
        vertices[2] = new Vector2(0f , 85);
        vertices[3] = new Vector2(5f , 68f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(0f  , -60f  );
        vertices[1] = new Vector2(-50f , 0f  );
        vertices[2] = new Vector2(-60f , 0);
        vertices[3] = new Vector2(-10f , -60f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
   
    {
      PolygonShape groundPoly = new PolygonShape();
      Vector2[] vertices = new Vector2[4]
     
        vertices[0] = new Vector2(0f  , 75f  );
        vertices[1] = new Vector2(-65f , 30f  );
        vertices[2] = new Vector2(-50f , 30);
        vertices[3] = new Vector2(10f , 75f);
        groundPoly.set(vertices);
 
      BodyDef groundBodyDef = new BodyDef();
      groundBodyDef.type = BodyType.StaticBody;
      groundBodyDef.position.x = 10;
      groundBodyDef.position.y = 0;
      groundBody = world.createBody(groundBodyDef);
 
      FixtureDef fixtureDef = new FixtureDef();
      fixtureDef.shape = groundPoly;
      fixtureDef.filter.groupIndex = 0;
      groundBody.createFixture(fixtureDef);
      groundPoly.dispose();
    }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.physics.box2d.FixtureDef

Copyright © 2018 www.massapicom. 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.