Examples of FixtureDef


Examples of org.jbox2d.dynamics.FixtureDef

      portion=creator.getMaxPower()/4;
      updatePower(creator.getPower());
      creator.addPropertiesChangeListener(this);
     
      CircleShape shape=new CircleShape();
      FixtureDef fixtureDef=new FixtureDef();
     
      shape.m_radius=CoordinateConverter.scalerPixelsToWorld(CORE_RADIUS);
      fixtureDef.shape=shape;
      fixtureDef.density=1f;
      fixtureDef.restitution=0.6f;
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

  private GravitationalArea(int contentPower,boolean beControlled ,Point p, double radius) {
    super(contentPower,beControlled ,p, 2*radius, 2*radius, 0);
    if(isVerified()){
      body.setType(BodyType.STATIC);
     
      FixtureDef fixtureDef=new FixtureDef();
      CircleShape shape=new CircleShape();
     
      this.radius = radius;
      this.center=body.getPosition();
     
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

   
    aabb=new PixelAABB(this.position,width,height);
   
    BodyDef bodyDef=new BodyDef();
    CircleShape shape=new CircleShape();
    FixtureDef fixtureDef=new FixtureDef();
    Vec2 impulse=CoordinateConverter.vectorPixelsToWorld(new Vector(-30+60*Random.nextDouble(),-(175+50*Random.nextDouble())));
   
    bodyDef.type=BodyType.DYNAMIC;
    bodyDef.position.set(CoordinateConverter.coordPixelsToWorld(position));
   
 
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

 
  /**
   * Create a new primitive shape
   */
  protected PrimitiveShape() {
    this.def = new FixtureDef();
  }
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

    }

    m_bodies[m_bodyIndex] = getWorld().createBody(bd);

    if (index < 4) {
      FixtureDef fd = new FixtureDef();
      fd.shape = m_polygons[index];
      fd.friction = 0.3f;
      m_bodies[m_bodyIndex].createFixture(fd);
    } else {
      FixtureDef fd = new FixtureDef();
      fd.shape = m_circle;
      fd.friction = 0.3f;

      m_bodies[m_bodyIndex].createFixture(fd);
    }
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

      float y = cy + ry * (float) Math.cos(angle);
      bd.position.set(new Vec2(x, y));
      bd.type = BodyType.DYNAMIC;
      Body body = getWorld().createBody(bd);

      FixtureDef fd = new FixtureDef();
      CircleShape cd = new CircleShape();
      cd.m_radius = bodyRadius;
      fd.shape = cd;
      fd.density = 1.0f;
      body.createFixture(fd);
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

    bomb.setLinearVelocity(velocity);

    CircleShape circle = new CircleShape();
    circle.m_radius = 0.3f;

    FixtureDef fd = new FixtureDef();
    fd.shape = circle;
    fd.density = 20f;
    fd.restitution = 0;

    Vec2 minV = new Vec2(position);
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

    // PointDef pd = new PointDef();
    // pd.mass = massPerParticle;
    // pd.restitution = 0.0f;
    // pd.filter.groupIndex = -10;
    CircleShape pd = new CircleShape();
    FixtureDef fd = new FixtureDef();
    fd.shape = pd;
    fd.density = 1f;
    fd.filter.groupIndex = -10;
    pd.m_radius = .05f;
    fd.restitution = 0.4f;
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

      if (liquid[i].getWorldCenter().y < -10.0f) {
        getWorld().destroyBody(liquid[i]);
        float massPerParticle = totalMass / nParticles;

        CircleShape pd = new CircleShape();
        FixtureDef fd = new FixtureDef();
        fd.shape = pd;
        fd.density = 1.0f;
        fd.filter.groupIndex = -10;
        pd.m_radius = .05f;
        fd.restitution = 0.4f;
View Full Code Here

Examples of org.jbox2d.dynamics.FixtureDef

      bd.position.set(0.0f, 20.0f);
      ground = getWorld().createBody(bd);

      EdgeShape shape = new EdgeShape();

      FixtureDef sd = new FixtureDef();
      sd.shape = shape;
      sd.density = 0.0f;
      sd.restitution = k_restitution;

      // Left vertical
      shape.set(new Vec2(-20.0f, -20.0f), new Vec2(-20.0f, 20.0f));
      ground.createFixture(sd);

      // Right vertical
      shape.set(new Vec2(20.0f, -20.0f), new Vec2(20.0f, 20.0f));
      ground.createFixture(sd);

      // Top horizontal
      shape.set(new Vec2(-20.0f, 20.0f), new Vec2(20.0f, 20.0f));
      ground.createFixture(sd);

      // Bottom horizontal
      shape.set(new Vec2(-20.0f, -20.0f), new Vec2(20.0f, -20.0f));
      ground.createFixture(sd);
    }

    {
      Transform xf1 = new Transform();
      xf1.q.set(0.3524f * MathUtils.PI);
      Rot.mulToOutUnsafe(xf1.q, new Vec2(1.0f, 0.0f), xf1.p);

      Vec2 vertices[] = new Vec2[3];
      vertices[0] = Transform.mul(xf1, new Vec2(-1.0f, 0.0f));
      vertices[1] = Transform.mul(xf1, new Vec2(1.0f, 0.0f));
      vertices[2] = Transform.mul(xf1, new Vec2(0.0f, 0.5f));

      PolygonShape poly1 = new PolygonShape();
      poly1.set(vertices, 3);

      FixtureDef sd1 = new FixtureDef();
      sd1.shape = poly1;
      sd1.density = 4.0f;

      Transform xf2 = new Transform();
      xf2.q.set(-0.3524f * MathUtils.PI);
      Rot.mulToOut(xf2.q, new Vec2(-1.0f, 0.0f), xf2.p);

      vertices[0] = Transform.mul(xf2, new Vec2(-1.0f, 0.0f));
      vertices[1] = Transform.mul(xf2, new Vec2(1.0f, 0.0f));
      vertices[2] = Transform.mul(xf2, new Vec2(0.0f, 0.5f));

      PolygonShape poly2 = new PolygonShape();
      poly2.set(vertices, 3);

      FixtureDef sd2 = new FixtureDef();
      sd2.shape = poly2;
      sd2.density = 2.0f;

      BodyDef bd = new BodyDef();
      bd.type = BodyType.DYNAMIC;
      bd.angularDamping = 5.0f;
      bd.linearDamping = 0.1f;

      bd.position.set(0.0f, 2.0f);
      bd.angle = MathUtils.PI;
      bd.allowSleep = false;
      m_body = getWorld().createBody(bd);
      m_body.createFixture(sd1);
      m_body.createFixture(sd2);
    }

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

      FixtureDef fd = new FixtureDef();
      fd.shape = shape;
      fd.density = 1.0f;
      fd.friction = 0.3f;

      for (int i = 0; i < 10; ++i) {
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.