Package com.bulletphysics.dynamics

Examples of com.bulletphysics.dynamics.DiscreteDynamicsWorld$InplaceSolverIslandCallback


    Vector3f worldMin = new Vector3f(-1000f, -1000f, -1000f);
    Vector3f worldMax = new Vector3f(1000f, 1000f, 1000f);
    //broadphase = new AxisSweep3(worldMin, worldMax);
    broadphase = new DbvtBroadphase();
    solver = new SequentialImpulseConstraintSolver();
    dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);

    // JAVA NOTE: added
    dynamicsWorld.setDebugDrawer(new GLDebugDrawer(gl));
   
    float mass = 0f;
View Full Code Here


    //btConstraintSolver* constraintSolver = new OdeConstraintSolver();
    //#else
    ConstraintSolver constraintSolver = new SequentialImpulseConstraintSolver();
    //#endif

    dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, constraintSolver, collision_config);

    dynamicsWorld.setGravity(new Vector3f(0f, -30f, 0f));

    dynamicsWorld.setDebugDrawer(new GLDebugDrawer(gl));

View Full Code Here

    Vector3f worldMin = new Vector3f(-1000,-1000,-1000);
    Vector3f worldMax = new Vector3f(1000,1000,1000);
    //overlappingPairCache = new AxisSweep3(worldMin,worldMax);
    overlappingPairCache = new DbvtBroadphase();
    constraintSolver = new SequentialImpulseConstraintSolver();
    dynamicsWorld = new DiscreteDynamicsWorld(dispatcher,overlappingPairCache,constraintSolver,collisionConfiguration);
    //#ifdef FORCE_ZAXIS_UP
    //m_dynamicsWorld->setGravity(btVector3(0,0,-10));
    //#endif

    //m_dynamicsWorld->setGravity(btVector3(0,0,0));
View Full Code Here

    Vector3f worldMax = new Vector3f(1000f,1000f,1000f);
    AxisSweep3 sweepBP = new AxisSweep3(worldMin, worldMax);
    overlappingPairCache = sweepBP;

    constraintSolver = new SequentialImpulseConstraintSolver();
    dynamicsWorld = new DiscreteDynamicsWorld(dispatcher,overlappingPairCache,constraintSolver,collisionConfiguration);

    Transform startTransform = new Transform();
    startTransform.setIdentity();
    startTransform.origin.set(0.0f, 4.0f, 0.0f);
View Full Code Here

    // the default constraint solver. For parallel processing you can use a
    // different solver (see Extras/BulletMultiThreaded)
    SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();

    DiscreteDynamicsWorld dynamicsWorld = new DiscreteDynamicsWorld(
        dispatcher, overlappingPairCache, solver,
        collisionConfiguration);

    dynamicsWorld.setGravity(new Vector3f(0, -10, 0));

    // create a few basic rigid bodies
    CollisionShape groundShape = new BoxShape(new Vector3f(50.f, 50.f, 50.f));

    // keep track of the shapes, we release memory at exit.
    // make sure to re-use collision shapes among rigid bodies whenever
    // possible!
    ObjectArrayList<CollisionShape> collisionShapes = new ObjectArrayList<CollisionShape>();

    collisionShapes.add(groundShape);

    Transform groundTransform = new Transform();
    groundTransform.setIdentity();
    groundTransform.origin.set(new Vector3f(0.f, -56.f, 0.f));

    {
      float mass = 0f;

      // rigidbody is dynamic if and only if mass is non zero,
      // otherwise static
      boolean isDynamic = (mass != 0f);

      Vector3f localInertia = new Vector3f(0, 0, 0);
      if (isDynamic) {
        groundShape.calculateLocalInertia(mass, localInertia);
      }

      // using motionstate is recommended, it provides interpolation
      // capabilities, and only synchronizes 'active' objects
      DefaultMotionState myMotionState = new DefaultMotionState(groundTransform);
      RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(
          mass, myMotionState, groundShape, localInertia);
      RigidBody body = new RigidBody(rbInfo);

      // add the body to the dynamics world
      dynamicsWorld.addRigidBody(body);
    }

    {
      // create a dynamic rigidbody

      // btCollisionShape* colShape = new
      // btBoxShape(btVector3(1,1,1));
      CollisionShape colShape = new SphereShape(1.f);
      collisionShapes.add(colShape);

      // Create Dynamic Objects
      Transform startTransform = new Transform();
      startTransform.setIdentity();

      float mass = 1f;

      // rigidbody is dynamic if and only if mass is non zero,
      // otherwise static
      boolean isDynamic = (mass != 0f);

      Vector3f localInertia = new Vector3f(0, 0, 0);
      if (isDynamic) {
        colShape.calculateLocalInertia(mass, localInertia);
      }

      startTransform.origin.set(new Vector3f(2, 10, 0));

      // using motionstate is recommended, it provides
      // interpolation capabilities, and only synchronizes
      // 'active' objects
      DefaultMotionState myMotionState = new DefaultMotionState(startTransform);

      RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(
          mass, myMotionState, colShape, localInertia);
      RigidBody body = new RigidBody(rbInfo);

      dynamicsWorld.addRigidBody(body);
    }

    // Do some simulation
    for (int i=0; i<100; i++) {
      dynamicsWorld.stepSimulation(1.f / 60.f, 10);

      // print positions of all objects
      for (int j=dynamicsWorld.getNumCollisionObjects()-1; j>=0; j--)
      {
        CollisionObject obj = dynamicsWorld.getCollisionObjectArray().getQuick(j);
        RigidBody body = RigidBody.upcast(obj);
        if (body != null && body.getMotionState() != null) {
          Transform trans = new Transform();
          body.getMotionState().getWorldTransform(trans);
          System.out.printf("world pos = %f,%f,%f\n", trans.origin.x,
View Full Code Here

    solver = sol;
   
    // TODO: needed for SimpleDynamicsWorld
    //sol.setSolverMode(sol.getSolverMode() & ~SolverMode.SOLVER_CACHE_FRIENDLY.getMask());
   
    dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);

    dynamicsWorld.setGravity(new Vector3f(0f, -10f, 0f));

    // create a few basic rigid bodies
    CollisionShape groundShape = new BoxShape(new Vector3f(50f, 50f, 50f));
View Full Code Here

    //broadphase = new SimpleBroadphase();
    broadphase = new DbvtBroadphase();
    //btOverlappingPairCache* broadphase = new btSimpleBroadphase();
    solver = new SequentialImpulseConstraintSolver();
    //ConstraintSolver* solver = new OdeConstraintSolver;
    dynamicsWorld = new DiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);

    Vector3f gravity = new Vector3f();
    gravity.negate(cameraUp);
    gravity.scale(10f);
    dynamicsWorld.setGravity(gravity);
View Full Code Here

        broadphase = new DbvtBroadphase();
        broadphase.getOverlappingPairCache().setInternalGhostPairCallback(new GhostPairCallback());
        CollisionConfiguration defaultCollisionConfiguration = new DefaultCollisionConfiguration();
        dispatcher = new CollisionDispatcher(defaultCollisionConfiguration);
        SequentialImpulseConstraintSolver sequentialImpulseConstraintSolver = new SequentialImpulseConstraintSolver();
        discreteDynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, sequentialImpulseConstraintSolver, defaultCollisionConfiguration);
        discreteDynamicsWorld.setGravity(new Vector3f(0f, -15f, 0f));
        blockEntityRegistry = CoreRegistry.get(BlockEntityRegistry.class);

        wrapper = new PhysicsWorldWrapper(world);
        VoxelWorldShape worldShape = new VoxelWorldShape(wrapper);
View Full Code Here

TOP

Related Classes of com.bulletphysics.dynamics.DiscreteDynamicsWorld$InplaceSolverIslandCallback

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.