Package net.phys2d.raw

Examples of net.phys2d.raw.Body


    body.setRotatable(false);
    return init(entity, body);
  }
 
  public Body addBall(Entity entity, float radius) {
    Body body = new Body(new Circle(radius), this.mass);
    body.setPosition(this.position.getX(), this.position.getY());
    return init(entity, body);
  }
View Full Code Here


    body.setPosition(this.position.getX(), this.position.getY());
    return init(entity, body);
  }
 
  public Body addAxisAlignedWall(Entity entity, float startX, float startY, float x, float y) {
    Body body = new StaticBody(new Box(x, y));
    body.setPosition(startX + x / 2.0f, startY + y / 2.0f);
    return init(entity, body);
  }
View Full Code Here

    Transform transform = new Transform(x, y, angle);
    e.addComponent(transform);
    e.addComponent(new SpatialForm("bullet"));
    e.addComponent(new Expiration(1500));

    Body b = new Body(new Box(10, 10), 0.2f);
    b.setUserData(e);
    b.addExcludedBody(shooter.getComponent(Physics.class).getBody());
    b.setBitmask(1);
    b.setPosition(x, y);
    b.setRestitution(0);
    b.setDamping(0.002f);
    b.setFriction(10);
    b.setRotation(angle);
    // b.setForce(10000f*TrigLUT.cosDeg(angle),
    // 10000f*TrigLUT.sinDeg(angle));
    b.adjustVelocity(new Vector2f(1000f * TrigLUT.cosDeg(angle), 1000f * TrigLUT.sinDeg(angle)));

    // b.setDensity(100);
    // b.setFriction(1.1f);
    // b.setDamping(0.002f);
    // b.setRestitution(0);
View Full Code Here

    world.getManager(GroupManager.class).add(e, "walls");

    SpatialForm form = new SpatialForm("wall");
    e.addComponent(form);

    Body b = new Body(new Box(214, 214), 0.3f);
    b.setMoveable(false);
    b.setRotatable(false);
    b.setUserData(e);
    b.setPosition(x, y);
    b.setDamping(0.1f);
    b.setRestitution(0);
    b.setRotDamping(10f);
    b.setFriction(100);
    e.addComponent(new Physics(b));

    e.addToWorld();

    return e;
View Full Code Here

    e.addComponent(new Health(100, 160));

    SpatialForm form = new SpatialForm("crate");
    e.addComponent(form);

    Body b = new Body(new Box(50, 50), 0.3f);
    b.setUserData(e);
    b.setPosition(x, y);
    b.setDamping(0.1f);
    b.setRestitution(0);
    b.setRotDamping(10f);
    b.setFriction(100);
    b.setRotation(angleDeg);
    e.addComponent(new Physics(b));

    e.addToWorld();

    return e;
View Full Code Here

    e.addComponent(new TurnFactor());
    e.addComponent(new Tower());
    e.addComponent(new Health(110, 150));
    e.addComponent(new Ammo(78, 150));

    Body b = new Body(new Box(125, 104), 1f);
    b.setUserData(e);
    b.setPosition(x, y);
    b.setDamping(0.1f);
    b.setRestitution(0);
    b.setRotDamping(50f);
    b.setFriction(100);
    e.addComponent(new Physics(b));

    return e;
  }
View Full Code Here

      localObject = new StaticBody(paramb.b(), a(paramb.o()));
      paramb.i(((Body)localObject).getMass());
    }
    else
    {
      localObject = new Body(paramb.b(), a(paramb.o()), (float)paramb.n());
    }
    paramb.a(Long.valueOf(((Body)localObject).getID()));
    a((Body)localObject, paramb);
    return localObject;
  }
View Full Code Here

  public com.a.b.b a(com.a.b.b paramb)
  {
    this.a.lock();
    try
    {
      Body localBody = c.a(paramb);
      this.c.add(localBody);
      this.b.put(Long.valueOf(localBody.getID()), localBody);
      com.a.b.b localb = c.a(localBody);
      return localb;
    }
    finally
    {
View Full Code Here

  public void b(com.a.b.b paramb)
  {
    this.a.lock();
    try
    {
      Body localBody = (Body)this.b.get(paramb.a());
      if (localBody == null)
        throw new IllegalArgumentException("No body with ID " + paramb.a() + '.');
      c.a(localBody, paramb);
    }
    finally
View Full Code Here

  public com.a.b.b a(long paramLong)
  {
    this.a.lock();
    try
    {
      Body localBody = (Body)this.b.remove(Long.valueOf(paramLong));
      if (localBody == null)
      {
        localb = null;
        return localb;
      }
View Full Code Here

TOP

Related Classes of net.phys2d.raw.Body

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.