Package com.bulletphysics.dynamics

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


    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

 
  // 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

      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

    }

    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

        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

        // 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

    }

    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

      dynamicsWorld.debugDrawWorld();
    }

    for (int i=2; i>=0; i--) {
      CollisionObject obj = dynamicsWorld.getCollisionObjectArray().getQuick(i);
      RigidBody body = RigidBody.upcast(obj);
      drawFrame(body.getWorldTransform(new Transform()));
    }
   
    renderme();

    //glFlush();
View Full Code Here

    startTransform.origin.set(0f, 25f, -200f);
    staticScenario.addChildShape(startTransform, staticboxShape5);

    startTransform.origin.set(0f, 0f, 0f);

    RigidBody staticBody = localCreateRigidBody(mass, startTransform, staticScenario);

    staticBody.setCollisionFlags(staticBody.getCollisionFlags() | CollisionFlags.STATIC_OBJECT);

    // enable custom material callback
    //staticBody.setCollisionFlags(staticBody.getCollisionFlags() | CollisionFlags.CUSTOM_MATERIAL_CALLBACK);

    // static plane
    Vector3f normal = new Vector3f(0.4f, 1.5f, -0.4f);
    normal.normalize();
    CollisionShape staticplaneShape6 = new StaticPlaneShape(normal, 0f); // A plane

    startTransform.origin.set(0f, 0f, 0f);

    RigidBody staticBody2 = localCreateRigidBody(mass, startTransform, staticplaneShape6);

    staticBody2.setCollisionFlags(staticBody2.getCollisionFlags() | CollisionFlags.STATIC_OBJECT);

    for (int i=0; i<9; i++) {
      CollisionShape boxShape = new BoxShape(new Vector3f(1f, 1f, 1f));
      startTransform.origin.set(2f * i - 5f, 2f, -3f);
      localCreateRigidBody(1, startTransform, boxShape);
View Full Code Here

TOP

Related Classes of com.bulletphysics.dynamics.RigidBody

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.