Package com.badlogic.gdx.physics.box2d

Examples of com.badlogic.gdx.physics.box2d.Body.createFixture()


    final float halfHeight = pHeight * 0.5f / pPixelToMeterRatio;

    boxPoly.setAsBox(halfWidth, halfHeight);
    pFixtureDef.shape = boxPoly;

    boxBody.createFixture(pFixtureDef);

    boxPoly.dispose();

    boxBody.setTransform(boxBody.getWorldCenter(), MathUtils.degToRad(pRotation));

View Full Code Here


    pFixtureDef.shape = circlePoly;

    final float radius = pRadius / pPixelToMeterRatio;
    circlePoly.setRadius(radius);

    circleBody.createFixture(pFixtureDef);

    circlePoly.dispose();

    return circleBody;
  }
View Full Code Here

    final PolygonShape linePoly = new PolygonShape();
   
    linePoly.setAsEdge(new Vector2(pX1 / pPixelToMeterRatio, pY1 / pPixelToMeterRatio), new Vector2(pX2 / pPixelToMeterRatio, pY2 / pPixelToMeterRatio));
    pFixtureDef.shape = linePoly;
   
    boxBody.createFixture(pFixtureDef);
   
    linePoly.dispose();
   
    return boxBody;
  }
View Full Code Here

    final PolygonShape boxPoly = new PolygonShape();

    boxPoly.set(pVertices);
    pFixtureDef.shape = boxPoly;

    boxBody.createFixture(pFixtureDef);

    boxPoly.dispose();

    return boxBody;
  }
View Full Code Here

      TMP_TRIANGLE[0] = pTriangleVertices.get(i++);

      boxPoly.set(TMP_TRIANGLE);
      pFixtureDef.shape = boxPoly;

      boxBody.createFixture(pFixtureDef);

      boxPoly.dispose();
    }

    return boxBody;
View Full Code Here

      // Create the BodyDef, set a random position above the
      // ground and create a new body
      boxBodyDef.position.x = -20 + (float) (Math.random() * 40);
      boxBodyDef.position.y = 10 + (float) (Math.random() * 15);
      Body boxBody = world.createBody(boxBodyDef);
      boxBody.createFixture(def);
      balls.add(boxBody);
    }
    ballShape.dispose();
  }

View Full Code Here

                        bodyDef.type = BodyDef.BodyType.StaticBody;
                        bodyDef.position.set(Detonator.WORLD_TO_BOX2D*((x*Terrain.tileWidth)-(Terrain.tileWidth / 2)), Detonator.WORLD_TO_BOX2D*(y*Terrain.tileHeight));
                        Body boxBody = map.world.createBody(bodyDef);
                        CircleShape circle = new CircleShape();
                        circle.setRadius(Detonator.WORLD_TO_BOX2D*8);
                        boxBody.createFixture(new CircleShape(),0.5f);
                       
                        Log.info("COLLIDES, map coords: "+Detonator.WORLD_TO_BOX2D*((x*Terrain.tileWidth)-(Terrain.tileWidth / 2))+":"+Detonator.WORLD_TO_BOX2D*(y*Terrain.tileHeight));
                       
                    }
                }
View Full Code Here

    boxBodyDef.angle = angle;
    boxBodyDef.angularDamping = 1f;
    boxBodyDef.linearDamping = 1.0f;
    Body boxBody = world.createBody(boxBodyDef);

    boxBody.createFixture(boxPoly, 1);
    // add the box to our list of boxes
    body = boxBody;
   
    body.setUserData(this);
   
View Full Code Here

    boxBodyDef.angle = angle;
    boxBodyDef.angularDamping = 1f;
    boxBodyDef.linearDamping = 1.0f;
    Body boxBody = world.createBody(boxBodyDef);

    boxBody.createFixture(boxPoly, 1);
    // add the box to our list of boxes
    body = boxBody;
   
    body.setUserData(this);
   
View Full Code Here

      boxBodyDef.position.y = MathUtils.random(-20, 45);
      boxBodyDef.angularDamping = 1f;
      boxBodyDef.linearDamping = 1.0f;
      Body boxBody = world.createBody(boxBodyDef);

      boxBody.createFixture(boxPoly, 1);

      enemies.add(new EnemyShip(boxBody));
      boxBody.setUserData(enemies.get(enemies.size-1));
    }
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.