Package com.bulletphysics.collision.narrowphase

Examples of com.bulletphysics.collision.narrowphase.GjkConvexCast


      SphereShape sphere1 = new SphereShape(col1.getCcdSweptSphereRadius()); // todo: allow non-zero sphere sizes, for better approximation
      ConvexCast.CastResult result = new ConvexCast.CastResult();
      VoronoiSimplexSolver voronoiSimplex = new VoronoiSimplexSolver();
      //SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex);
      ///Simplification, one object is simplified as a sphere
      GjkConvexCast ccd1 = new GjkConvexCast(convex0, sphere1, voronoiSimplex);
      //ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0);
      if (ccd1.calcTimeOfImpact(col0.getWorldTransform(tmpTrans1), col0.getInterpolationWorldTransform(tmpTrans2),
          col1.getWorldTransform(tmpTrans3), col1.getInterpolationWorldTransform(tmpTrans4), result)) {
        // store result.m_fraction in both bodies

        if (col0.getHitFraction() > result.fraction) {
          col0.setHitFraction(result.fraction);
        }

        if (col1.getHitFraction() > result.fraction) {
          col1.setHitFraction(result.fraction);
        }

        if (resultFraction > result.fraction) {
          resultFraction = result.fraction;
        }
      }
    }

    // Sphere (for convex0) against Convex1
    {
      ConvexShape convex1 = (ConvexShape) col1.getCollisionShape();

      SphereShape sphere0 = new SphereShape(col0.getCcdSweptSphereRadius()); // todo: allow non-zero sphere sizes, for better approximation
      ConvexCast.CastResult result = new ConvexCast.CastResult();
      VoronoiSimplexSolver voronoiSimplex = new VoronoiSimplexSolver();
      //SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex);
      ///Simplification, one object is simplified as a sphere
      GjkConvexCast ccd1 = new GjkConvexCast(sphere0, convex1, voronoiSimplex);
      //ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0);
      if (ccd1.calcTimeOfImpact(col0.getWorldTransform(tmpTrans1), col0.getInterpolationWorldTransform(tmpTrans2),
          col1.getWorldTransform(tmpTrans3), col1.getInterpolationWorldTransform(tmpTrans4), result)) {
        //store result.m_fraction in both bodies

        if (col0.getHitFraction() > result.fraction) {
          col0.setHitFraction(result.fraction);
View Full Code Here


      VoronoiSimplexSolver simplexSolver = new VoronoiSimplexSolver();
      GjkEpaPenetrationDepthSolver gjkEpaPenetrationSolver = new GjkEpaPenetrationDepthSolver();

      // JAVA TODO: should be convexCaster1
      //ContinuousConvexCollision convexCaster1(castShape,convexShape,&simplexSolver,&gjkEpaPenetrationSolver);
      GjkConvexCast convexCaster2 = new GjkConvexCast(castShape, convexShape, simplexSolver);
      //btSubsimplexConvexCast convexCaster3(castShape,convexShape,&simplexSolver);

      ConvexCast castPtr = convexCaster2;

      if (castPtr.calcTimeOfImpact(convexFromTrans, convexToTrans, colObjWorldTransform, colObjWorldTransform, castResult)) {
View Full Code Here

TOP

Related Classes of com.bulletphysics.collision.narrowphase.GjkConvexCast

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.