Package com.bulletphysics.collision.shapes

Examples of com.bulletphysics.collision.shapes.ConcaveShape


      //}

      if (col.getShapeType() == BroadphaseNativeType.GIMPACT_SHAPE_PROXYTYPE) {

        ConcaveShape polyshape = (ConcaveShape) col;
        /*
        int i;
        for (i=0;i<polyshape.getNumEdges();i++)
        {
          Vector3f a = Stack.alloc(Vector3f.class);
View Full Code Here


      CompoundShape compoundshape = (CompoundShape) shape1;
      gimpact_vs_compoundshape(body0, body1, shape0, compoundshape, swapped);
      return;
    }
    else if (shape1.isConcave()) {
      ConcaveShape concaveshape = (ConcaveShape) shape1;
      gimpact_vs_concave(body0, body1, shape0, concaveshape, swapped);
      return;
    }

    Transform orgtrans0 = body0.getWorldTransform(Stack.alloc(Transform.class));
View Full Code Here

//        {
//    #else   
      if (shape.isConcave())//>getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE||shape->getShapeType() == GIMPACT_SHAPE_PROXYTYPE)
      //    if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
      {
        ConcaveShape concaveMesh = (ConcaveShape) shape;
        //btVector3 aabbMax(btScalar(1e30),btScalar(1e30),btScalar(1e30));
        //btVector3 aabbMax(100,100,100);//btScalar(1e30),btScalar(1e30),btScalar(1e30));

        //todo pass camera, for some culling
        Vector3f aabbMax = vectorsPool.get();
        aabbMax.set(1e30f, 1e30f, 1e30f);
        Vector3f aabbMin = vectorsPool.get();
        aabbMin.set(-1e30f, -1e30f, -1e30f);

        GlDrawcallback drawCallback = new GlDrawcallback(gl);
        drawCallback.wireframe = (debugMode & DebugDrawModes.DRAW_WIREFRAME) != 0;

        concaveMesh.processAllTriangles(drawCallback, aabbMin, aabbMax);
       
        vectorsPool.release(aabbMax);
        vectorsPool.release(aabbMin);
      }
      //#endif
View Full Code Here

          BridgeTriangleRaycastCallback rcb = new BridgeTriangleRaycastCallback(rayFromLocal, rayToLocal, resultCallback, collisionObject, triangleMesh);
          rcb.hitFraction = resultCallback.closestHitFraction;
          triangleMesh.performRaycast(rcb, rayFromLocal, rayToLocal);
        }
        else {
          ConcaveShape triangleMesh = (ConcaveShape)collisionShape;

          Transform worldTocollisionObject = Stack.alloc(Transform.class);
          worldTocollisionObject.inverse(colObjWorldTransform);

          Vector3f rayFromLocal = Stack.alloc(rayFromTrans.origin);
          worldTocollisionObject.transform(rayFromLocal);
          Vector3f rayToLocal = Stack.alloc(rayToTrans.origin);
          worldTocollisionObject.transform(rayToLocal);

          BridgeTriangleRaycastCallback rcb = new BridgeTriangleRaycastCallback(rayFromLocal, rayToLocal, resultCallback, collisionObject, triangleMesh);
          rcb.hitFraction = resultCallback.closestHitFraction;

          Vector3f rayAabbMinLocal = Stack.alloc(rayFromLocal);
          VectorUtil.setMin(rayAabbMinLocal, rayToLocal);
          Vector3f rayAabbMaxLocal = Stack.alloc(rayFromLocal);
          VectorUtil.setMax(rayAabbMaxLocal, rayToLocal);

          triangleMesh.processAllTriangles(rcb, rayAabbMinLocal, rayAabbMaxLocal);
        }
      }
      else {
        // todo: use AABB tree or other BVH acceleration structure!
        if (collisionShape.isCompound()) {
View Full Code Here

          Vector3f boxMaxLocal = Stack.alloc(Vector3f.class);
          castShape.getAabb(rotationXform, boxMinLocal, boxMaxLocal);
          triangleMesh.performConvexcast(tccb, convexFromLocal, convexToLocal, boxMinLocal, boxMaxLocal);
        }
        else {
          ConcaveShape triangleMesh = (ConcaveShape)collisionShape;
          Transform worldTocollisionObject = Stack.alloc(Transform.class);
          worldTocollisionObject.inverse(colObjWorldTransform);

          Vector3f convexFromLocal = Stack.alloc(Vector3f.class);
          convexFromLocal.set(convexFromTrans.origin);
          worldTocollisionObject.transform(convexFromLocal);

          Vector3f convexToLocal = Stack.alloc(Vector3f.class);
          convexToLocal.set(convexToTrans.origin);
          worldTocollisionObject.transform(convexToLocal);

          // rotation of box in local mesh space = MeshRotation^-1 * ConvexToRotation
          Transform rotationXform = Stack.alloc(Transform.class);
          Matrix3f tmpMat = Stack.alloc(Matrix3f.class);
          tmpMat.mul(worldTocollisionObject.basis, convexToTrans.basis);
          rotationXform.set(tmpMat);

          BridgeTriangleConvexcastCallback tccb = new BridgeTriangleConvexcastCallback(castShape, convexFromTrans, convexToTrans, resultCallback, collisionObject, triangleMesh, colObjWorldTransform);
          tccb.hitFraction = resultCallback.closestHitFraction;
          tccb.normalInWorldSpace = false;
          Vector3f boxMinLocal = Stack.alloc(Vector3f.class);
          Vector3f boxMaxLocal = Stack.alloc(Vector3f.class);
          castShape.getAabb(rotationXform, boxMinLocal, boxMaxLocal);

          Vector3f rayAabbMinLocal = Stack.alloc(convexFromLocal);
          VectorUtil.setMin(rayAabbMinLocal, convexToLocal);
          Vector3f rayAabbMaxLocal = Stack.alloc(convexFromLocal);
          VectorUtil.setMax(rayAabbMaxLocal, convexToLocal);
          rayAabbMinLocal.add(boxMinLocal);
          rayAabbMaxLocal.add(boxMaxLocal);
          triangleMesh.processAllTriangles(tccb, rayAabbMinLocal, rayAabbMaxLocal);
        }
      }
      else {
        // todo: use AABB tree or other BVH acceleration structure!
        if (collisionShape.isCompound()) {
View Full Code Here

    CollisionObject convexBody = isSwapped ? body1 : body0;
    CollisionObject triBody = isSwapped ? body0 : body1;

    if (triBody.getCollisionShape().isConcave()) {
      CollisionObject triOb = triBody;
      ConcaveShape concaveShape = (ConcaveShape)triOb.getCollisionShape();

      if (convexBody.getCollisionShape().isConvex()) {
        float collisionMarginTriangle = concaveShape.getMargin();

        resultOut.setPersistentManifold(btConvexTriangleCallback.manifoldPtr);
        btConvexTriangleCallback.setTimeStepAndCounters(collisionMarginTriangle, dispatchInfo, resultOut);

        // Disable persistency. previously, some older algorithm calculated all contacts in one go, so you can clear it here.
        //m_dispatcher->clearManifold(m_btConvexTriangleCallback.m_manifoldPtr);

        btConvexTriangleCallback.manifoldPtr.setBodies(convexBody, triBody);

        concaveShape.processAllTriangles(
            btConvexTriangleCallback,
            btConvexTriangleCallback.getAabbMin(Stack.alloc(Vector3f.class)),
            btConvexTriangleCallback.getAabbMax(Stack.alloc(Vector3f.class)));

        resultOut.refreshContactPoints();
View Full Code Here

      raycastCallback.hitFraction = convexbody.getHitFraction();

      CollisionObject concavebody = triBody;

      ConcaveShape triangleMesh = (ConcaveShape)concavebody.getCollisionShape();

      if (triangleMesh != null) {
        triangleMesh.processAllTriangles(raycastCallback, rayAabbMin, rayAabbMax);
      }

      if (raycastCallback.hitFraction < convexbody.getHitFraction()) {
        convexbody.setHitFraction(raycastCallback.hitFraction);
        return raycastCallback.hitFraction;
View Full Code Here

TOP

Related Classes of com.bulletphysics.collision.shapes.ConcaveShape

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.