Package net.phys2d.raw.shapes

Examples of net.phys2d.raw.shapes.Box


    body.setPosition(startX + x / 2.0f, startY + y / 2.0f);
    return init(entity, body);
  }
 
  public Body addAxisAlignedWall(Entity entity, float width, float height) {
    StaticBody body = new StaticBody(new Box(width, height));
    body.setPosition(this.position.getX(), this.position.getY());
    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);
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);
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);
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);
View Full Code Here

      return new Circle((float)((a)localObject).a());
    }
    if ((paramb instanceof com.a.b.b.c))
    {
      localObject = (com.a.b.b.c)paramb;
      return new Box((float)((com.a.b.b.c)localObject).a(), (float)((com.a.b.b.c)localObject).c());
    }
    if ((paramb instanceof d))
    {
      localObject = (d)paramb;
      return new Line((float)((d)localObject).a(), (float)((d)localObject).c(), (float)((d)localObject).d(), (float)((d)localObject).e());
View Full Code Here

public class PolygonBoxCollider extends PolygonPolygonCollider
{
  public int collide(Contact[] paramArrayOfContact, Body paramBody1, Body paramBody2)
  {
    Polygon localPolygon = (Polygon)paramBody1.getShape();
    Box localBox = (Box)paramBody2.getShape();
    Vector2f[] arrayOfVector2f1 = localPolygon.getVertices(paramBody1.getPosition(), paramBody1.getRotation());
    Vector2f[] arrayOfVector2f2 = localBox.getPoints(paramBody2.getPosition(), paramBody2.getRotation());
    Vector2f localVector2f = new Vector2f(arrayOfVector2f2[1]);
    localVector2f.sub(arrayOfVector2f2[2]);
    EdgeSweep localEdgeSweep = new EdgeSweep(localVector2f);
    localEdgeSweep.addVerticesToSweep(true, arrayOfVector2f1);
    localEdgeSweep.addVerticesToSweep(false, arrayOfVector2f2);
View Full Code Here

  public strictfp int collide(Contact[] paramArrayOfContact, Body paramBody1, Body paramBody2)
  {
    int i = 0;
    Line localLine1 = (Line)paramBody1.getShape();
    Box localBox = (Box)paramBody2.getShape();
    Vector2f localVector2f1 = new Vector2f(localLine1.getDX(), localLine1.getDY());
    localVector2f1.normalise();
    Vector2f localVector2f2 = new Vector2f(-localLine1.getDY(), localLine1.getDX());
    localVector2f2.normalise();
    Vector2f localVector2f3 = new Vector2f();
    localLine1.getStart().projectOntoUnit(localVector2f2, localVector2f3);
    float f1 = getProp(localVector2f3, localVector2f2);
    Vector2f localVector2f4 = MathUtil.sub(paramBody2.getPosition(), paramBody1.getPosition());
    localVector2f4.projectOntoUnit(localVector2f2, localVector2f3);
    float f2 = getProp(localVector2f3, localVector2f2);
    Vector2f[] arrayOfVector2f = localBox.getPoints(paramBody2.getPosition(), paramBody2.getRotation());
    float[] arrayOfFloat1 = new float[4];
    float[] arrayOfFloat2 = new float[4];
    int j = 0;
    for (int k = 0; k < 4; k++)
    {
View Full Code Here

    float f3 = paramBody2.getPosition().getX();
    float f4 = paramBody2.getPosition().getY();
    boolean bool = paramBody1.getShape().getBounds().touches(f1, f2, paramBody2.getShape().getBounds(), f3, f4);
    if (!bool)
      return 0;
    Box localBox = (Box)paramBody1.getShape();
    Circle localCircle = (Circle)paramBody2.getShape();
    Vector2f[] arrayOfVector2f = localBox.getPoints(paramBody1.getPosition(), paramBody1.getRotation());
    Line[] arrayOfLine = new Line[4];
    arrayOfLine[0] = new Line(arrayOfVector2f[0], arrayOfVector2f[1]);
    arrayOfLine[1] = new Line(arrayOfVector2f[1], arrayOfVector2f[2]);
    arrayOfLine[2] = new Line(arrayOfVector2f[2], arrayOfVector2f[3]);
    arrayOfLine[3] = new Line(arrayOfVector2f[3], arrayOfVector2f[0]);
View Full Code Here

TOP

Related Classes of net.phys2d.raw.shapes.Box

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.