Examples of RigidBody


Examples of com.bulletphysics.dynamics.RigidBody


  }

  public boolean mouseOver(float mouseX, float mouseY) {
    RigidBody body = GLOBAL.jBullet.getOver(mouseX, mouseY);
    if (body == null || !this.on) {
      return false;
    } else {

      if (body != null
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

      Vector3f localInertia = new Vector3f(0, 0, 0);
      RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(0,
          motionState, groundShape, localInertia);

      // Create the rigid body and add it to the dynamicsworld.
      RigidBody body = new RigidBody(rbInfo);
      getDynamicsWorld().addRigidBody(body);

      // Set friction.
      //body.setFriction(1);

      // Store locally.
      this.ground = body;

    }

    else {
      System.out.println("Using chess surface ground");
      BoxShape bShape = new BoxShape(new Vector3f(20, 10, 20));

      for (int i = 0; i < 20; i++) {
        for (int j = 0; j < 21; j++) {
          // Create transform to store ground's location.
          Transform transform = new Transform();
          transform.setIdentity();
          float x = -10 * 40 + i * 40;
          float z = -10 * 40 + j * 40;
          transform.origin.set(new Vector3f(x, -10, z));

          // Create new MotionState to keep track of object.
          DefaultMotionState motionState = new DefaultMotionState(
              transform);
          Vector3f localInertia = new Vector3f(0, 0, 0);
          RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(
              0, motionState, bShape, localInertia);

          // Create the rigid body and add it to the dynamicsworld.
          RigidBody body = new RigidBody(rbInfo);
          getDynamicsWorld().addRigidBody(body);

          // Set friction.
          body.setFriction(1);
          body.setRestitution(1);
        }
      }
    }

    // Set gravity.
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

    DefaultMotionState myMotionState = new DefaultMotionState(transform);
   
    RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(
        mass, myMotionState, collisionShape, localInertia);
   
    body = new RigidBody(rbInfo);

    // Add the body to the dynamics world.
    // This is NOT the EAS-env! It's the 3D physics world.
    env.getDynamicsWorld().addRigidBody(body);
  }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

    transform.origin.set(this.position);   
    DefaultMotionState motionState = new DefaultMotionState(transform);
    box.calculateLocalInertia(mass, localInertia);
    RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(
        this.mass, motionState, box, localInertia);
    RigidBody body = new RigidBody(rbInfo);
    this.getDynamicsWorld().addRigidBody(body);
    this.body = body;
   
   
   
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

 
  // Does NOT work reliably!!!!
  public boolean touchesGround() {
    boolean result = false;
    //Get ground's rigid body.
    RigidBody groundBody = predecessor.getEnvironment().getGround();   
   
    //http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=&f=9&t=3188
    /* Scheint Probleme zu machen, da Boxen einfach durdch den Boden fallen!!!!!!!!
    CollisionAlgorithm ca = getDynamicsWorld().getDispatcher().findAlgorithm(groundBody, this.getRigidBody());
    ManifoldResult mr = new ManifoldResult(groundBody, this.getRigidBody());
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

      int numObjects = dynamicsWorld.getNumCollisionObjects();
      wireColor.set(1f, 0f, 0f);
      for (int i = 0; i < numObjects; i++) {
        CollisionObject colObj = dynamicsWorld
            .getCollisionObjectArray().getQuick(i);
        RigidBody body = RigidBody.upcast(colObj);

        if (body != null && body.getMotionState() != null) {
          DefaultMotionState myMotionState = (DefaultMotionState) body
              .getMotionState();
          m.set(myMotionState.graphicsWorldTrans);
        } else {
          colObj.getWorldTransform(m);
        }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

    }

    for (int i = 0; i < numObjects; i++) {
      CollisionObject colObj = dynamicsWorld.getCollisionObjectArray()
          .getQuick(i);
      RigidBody body = RigidBody.upcast(colObj);
      if (body != null) {
        if (body.getMotionState() != null) {
          DefaultMotionState myMotionState = (DefaultMotionState) body
              .getMotionState();
          myMotionState.graphicsWorldTrans
              .set(myMotionState.startWorldTrans);
          colObj.setWorldTransform(myMotionState.graphicsWorldTrans);
          colObj.setInterpolationWorldTransform(myMotionState.startWorldTrans);
          colObj.activate();
        }
        // removed cached contact points
        dynamicsWorld
            .getBroadphase()
            .getOverlappingPairCache()
            .cleanProxyFromPairs(colObj.getBroadphaseHandle(),
                getDynamicsWorld().getDispatcher());

        body = RigidBody.upcast(colObj);
        if (body != null && !body.isStaticObject()) {
          RigidBody.upcast(colObj).setLinearVelocity(
              new Vector3f(0f, 0f, 0f));
          RigidBody.upcast(colObj).setAngularVelocity(
              new Vector3f(0f, 0f, 0f));
        }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

        MotionStateBind motionState = new MotionStateBind(startTransform);
        motionState.setSpatial(box);
//         create the RigidBody for our box
        RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(mass,
                motionState, shape, localInertia);
        RigidBody body = new RigidBody(rbInfo);
//        body.setRestitution(0.1f);
//        body.setFriction(0.50f);
//        body.setDamping(0f, 0f);
        //body.setUserPointer(box);
        // add the box to the world
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

        // updates
        DefaultMotionState motionState = new DefaultMotionState(groundTransform);
        // create the RigidBody for our floor
        RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(mass,
                motionState, groundShape, localInertia);
        RigidBody body = new RigidBody(rbInfo);
        body.setUserPointer(floor);
        // add the floor to the world
        world.addRigidBody(body);
    }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBody

    }

    DefaultMotionState myMotionState = new DefaultMotionState(startTransform);
    RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(mass, myMotionState, shape, localInertia);
    rbInfo.additionalDamping = true;
    RigidBody body = new RigidBody(rbInfo);

    ownerWorld.addRigidBody(body);

    return body;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.