Package org.jbox2d.collision

Examples of org.jbox2d.collision.AABB


  }
  public static PixelAABB worldAABBToPixelAABB(AABB aabb){
    return new PixelAABB(coordWorldToPixels(aabb.lowerBound),coordWorldToPixels(aabb.upperBound));
  }
  public static AABB pixelAABBToWorldAABB(PixelAABB aabb){
    return new AABB(coordPixelToWorld(aabb.getLowerVertex()),coordPixelToWorld(aabb.getUpperVertex()));
  }
View Full Code Here


      Fixture[] fixtures=new Fixture[]{body.createFixture(triFixD),body.createFixture(recFixD)};
     
      this.checker=new Checker(fixtures);
     
      body.setTransform(body.getPosition(),(float)-angle);
      aabb=new AABB();
      aabb.combine(fixtures[0].getAABB(), fixtures[1].getAABB());
      forceVec=new Vec2((float)(radius*FORCE_MAGNITUDE_FACTOR*Math.cos(-angle)),(float)(radius*FORCE_MAGNITUDE_FACTOR*Math.sin(-angle)));
     
    }else{
      this.forceVec=null;
 
View Full Code Here

    }
    return world;
  }
 
  private World() {
    AABB bounds = new AABB(new Vec2(-10000, -10000), new Vec2(10000, 10000));
    Vec2 gravity = new Vec2(0, 0);
    jbox2dWorld = new org.jbox2d.dynamics.World(bounds, gravity, true);
  }
View Full Code Here

  /**
   * Get the bounding box that encloses this body and all of its constituent shapes
   * @return bounding box of all shapes enclosed in this body
   */
  public BoundingBox getBoundingBox(){
    AABB bodyAABB = new AABB(new AABB(new Vec2(Float.MAX_VALUE, Float.MAX_VALUE), new Vec2(Float.MIN_VALUE, Float.MIN_VALUE)));
    AABB shapeAABB = new AABB();
    for(org.jbox2d.collision.shapes.Shape jshape : shape.getJBoxShapes()){
      jshape.computeAABB(shapeAABB, jboxBody.m_xf);
      if(shapeAABB.lowerBound.x < bodyAABB.lowerBound.x){
        bodyAABB.lowerBound.x = shapeAABB.lowerBound.x;
      }
View Full Code Here

   *            x-coordinate of upper-right coordinate
   * @param y2
   *            y-coordinate of upper-right coordinate
   */
  public void setBounds(float x1, float y1, float x2, float y2) {
    worldAABB = new AABB(new Vec2(x1, y1), new Vec2(x2, y2));
    outOfBoundsRegions = new AABB[] {
        // everything below-left and directly left of worldAABB
        new AABB(new Vec2(Float.MIN_VALUE, Float.MIN_VALUE), new Vec2(
            x1, y2)),
        // everything above-left and directly above worldAABB
        new AABB(new Vec2(Float.MIN_VALUE, y2), new Vec2(x2,
            Float.MAX_VALUE)),
        // everything above-right and directly right of worldAABB
        new AABB(new Vec2(x2, y1), new Vec2(Float.MAX_VALUE,
            Float.MAX_VALUE)),
        // everything below-right and directly below worldAABB
        new AABB(new Vec2(x1, Float.MIN_VALUE), new Vec2(
            Float.MAX_VALUE, y1)) };
  }
View Full Code Here

    } else {
      lowerY = y2;
      upperY = y1;
    }

    AABB aabb = new AABB(new Vec2(lowerX, lowerY), new Vec2(upperX, upperY));
    final List<Body<?>> bodies = new LinkedList<Body<?>>();
    jboxWorld.queryAABB(new BodyQueryCallbackHelper(bodies), aabb);
    return bodies;
  }
View Full Code Here

    Common.info(5, "new mine");
    shoot.actions.removeAction("nogravity");
    shoot.actions.removeAction("collision");

    Vec2 range = damageRange;
    AABB rect = new AABB(new Vec2(-range.x, -range.y), new Vec2(range.x,
        range.y));
    shoot.explosionRelativeRectangle = rect;
    shoot.explosionDamage = 2;
    this.initializeShoot(shoot);
  }
View Full Code Here


            public Object force(Object o) {

                Mine mme = (Mine) me;
                AABB rr = new AABB(mme.explosionRelativeRectangle);
                Vec2 c = me.body.getWorldCenter();
                AABB ar = new AABB(new Vec2(c.x + rr.lowerBound.x/2, c.y
                                            + rr.lowerBound.y/2), new Vec2(c.x + rr.upperBound.x/2,
                                                    c.y + rr.upperBound.y/2)

                                  );
View Full Code Here

    public void specialMove(KeyFlag k) {

    }

    private boolean isOnAir() {
        AABB r = new AABB(getAABB());
        r.lowerBound.x=0f;
        r.upperBound.x=0f;
        r.lowerBound.x += body.getPosition().x;
        r.lowerBound.y += body.getPosition().y+0.2f;
        r.upperBound.x += body.getPosition().x;
View Full Code Here

    };
    mats = new OrderedStack<Mat22>(argSize, argContainerSize) {
      protected Mat22 newInstance() { return new Mat22(); }
    };
    aabbs = new OrderedStack<AABB>(argSize, argContainerSize) {
      protected AABB newInstance() { return new AABB(); }
    };
    rots = new OrderedStack<Rot>(argSize, argContainerSize) {
      protected Rot newInstance() { return new Rot(); }
    };
    mat33s = new OrderedStack<Mat33>(argSize, argContainerSize) {
View Full Code Here

TOP

Related Classes of org.jbox2d.collision.AABB

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.