Package com.bulletphysics.extras.gimpact.BoxCollision

Examples of com.bulletphysics.extras.gimpact.BoxCollision.AABB


    Vector3f tv1 = Stack.alloc(vertices1[1]);
    t.transform(tv1);
    Vector3f tv2 = Stack.alloc(vertices1[2]);
    t.transform(tv2);

    AABB trianglebox = Stack.alloc(AABB.class);
    trianglebox.init(tv0,tv1,tv2,collisionMargin);
   
    aabbMin.set(trianglebox.min);
    aabbMax.set(trianglebox.max);
  }
View Full Code Here


    }
  }

  @Override
  protected void calcLocalAABB() {
    AABB tmpAABB = Stack.alloc(AABB.class);

    localAABB.invalidate();
    int i = mesh_parts.size();
    while ((i--) != 0) {
      mesh_parts.getQuick(i).updateBound();
View Full Code Here

  }

  @Override
  public void processAllTriangles(TriangleCallback callback, Vector3f aabbMin, Vector3f aabbMax) {
    lockChildShapes();
    AABB box = Stack.alloc(AABB.class);
    box.min.set(aabbMin);
    box.max.set(aabbMax);

    collided.clear();
    box_set.boxQuery(box, collided);
View Full Code Here

  void gimpact_vs_gimpact_find_pairs(Transform trans0, Transform trans1, GImpactShapeInterface shape0, GImpactShapeInterface shape1, PairSet pairset) {
    if (shape0.hasBoxSet() && shape1.hasBoxSet()) {
      GImpactBvh.find_collision(shape0.getBoxSet(), trans0, shape1.getBoxSet(), trans1, pairset);
    }
    else {
      AABB boxshape0 = Stack.alloc(AABB.class);
      AABB boxshape1 = Stack.alloc(AABB.class);
      int i = shape0.getNumChildShapes();

      while ((i--) != 0) {
        shape0.getChildAabb(i, trans0, boxshape0.min, boxshape0.max);

        int j = shape1.getNumChildShapes();
        while ((j--) != 0) {
          shape1.getChildAabb(i, trans1, boxshape1.min, boxshape1.max);

          if (boxshape1.has_collision(boxshape0)) {
            pairset.push_pair(i, j);
          }
        }
      }
    }
View Full Code Here

      }
    }
  }

  protected void gimpact_vs_shape_find_pairs(Transform trans0, Transform trans1, GImpactShapeInterface shape0, CollisionShape shape1, IntArrayList collided_primitives) {
    AABB boxshape = Stack.alloc(AABB.class);

    if (shape0.hasBoxSet()) {
      Transform trans1to0 = Stack.alloc(Transform.class);
      trans1to0.inverse(trans0);
      trans1to0.mul(trans1);

      shape1.getAabb(trans1to0, boxshape.min, boxshape.max);

      shape0.getBoxSet().boxQuery(boxshape, collided_primitives);
    }
    else {
      shape1.getAabb(trans1, boxshape.min, boxshape.max);

      AABB boxshape0 = Stack.alloc(AABB.class);
      int i = shape0.getNumChildShapes();

      while ((i--) != 0) {
        shape0.getChildAabb(i, trans0, boxshape0.min, boxshape0.max);
View Full Code Here

    Vector4f plane = Stack.alloc(Vector4f.class);
    PlaneShape.get_plane_equation_transformed(planeshape, orgtrans1, plane);

    // test box against plane

    AABB tribox = Stack.alloc(AABB.class);
    shape0.getAabb(orgtrans0, tribox.min, tribox.max);
    tribox.increment_margin(planeshape.getMargin());

    if (tribox.plane_classify(plane) != PlaneIntersectionType.COLLIDE_PLANE) {
      return;
    }
    shape0.lockChildShapes();

    float margin = shape0.getMargin() + planeshape.getMargin();
View Full Code Here

    splitIndex = _sort_and_calc_splitting_index(primitive_boxes, startIndex, endIndex, splitIndex);

    //calc this node bounding box

    AABB node_bound = Stack.alloc(AABB.class);
    AABB tmpAABB = Stack.alloc(AABB.class);

    node_bound.invalidate();

    for (int i=startIndex; i<endIndex; i++) {
      primitive_boxes.getBound(i, tmpAABB);
View Full Code Here

   * If the Bounding box is not updated, then this class attemps to calculate it.<p>
     * Calls updateBound() for update the box set.
     */
  @Override
  public void getAabb(Transform t, Vector3f aabbMin, Vector3f aabbMax) {
    AABB transformedbox = Stack.alloc(localAABB);
    transformedbox.appy_transform(t);
    aabbMin.set(transformedbox.min);
    aabbMax.set(transformedbox.max);
  }
View Full Code Here

 
  /**
   * Retrieves the bound from a child.
   */
  public void getChildAabb(int child_index, Transform t, Vector3f aabbMin, Vector3f aabbMax) {
    AABB child_aabb = Stack.alloc(AABB.class);
    getPrimitiveManager().get_primitive_box(child_index, child_aabb);
    child_aabb.appy_transform(t);
    aabbMin.set(child_aabb.min);
    aabbMax.set(child_aabb.max);
  }
View Full Code Here

    return primitive_manager;
  }
 
  // stackless refit
  protected void refit() {
    AABB leafbox = Stack.alloc(AABB.class);
    AABB bound = Stack.alloc(AABB.class);
    AABB temp_box = Stack.alloc(AABB.class);

    int nodecount = getNodeCount();
    while ((nodecount--) != 0) {
      if (isLeafNode(nodecount)) {
        primitive_manager.get_primitive_box(getNodeData(nodecount), leafbox);
View Full Code Here

TOP

Related Classes of com.bulletphysics.extras.gimpact.BoxCollision.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.