Package com.bulletphysics.linearmath

Examples of com.bulletphysics.linearmath.DefaultMotionState


  }

  public void resetPhysics() {
    this.personSeated = false;
    rigidBody.setMotionState(new DefaultMotionState(
        this.startWorldTransform));
    GLOBAL.jBullet.update();

  }
View Full Code Here


    planeTransform.origin.set(this.scaleVal(600), this.scaleVal(600),
        this.scaleVal(0));

    // using motionstate is recommended, it provides interpolation
    // capabilities, and only synchronizes 'active' objects
    DefaultMotionState myMotionState2 = new DefaultMotionState(
        planeTransform);
    RigidBodyConstructionInfo rbInfo2 = new RigidBodyConstructionInfo(0,
        myMotionState2, constrainPlane, localInertia2);
    RigidBody body2 = new RigidBody(rbInfo2);
    this.constrainPlane2D = body2;

    // We can also use DemoApplication::localCreateRigidBody, but for
    // clarity it is provided here:
    {
      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);
       groundBody = new RigidBody(rbInfo);
View Full Code Here

    localInertia.set(0f, 0f, 0f);
    if (isDynamic) {
      shape.calculateLocalInertia(mass, localInertia);
    }

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

      Transform transform = new Transform();
      transform.setIdentity();
      transform.origin.set(new Vector3f(0, -10, 0));

      // 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, 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);

View Full Code Here

    // Calculate localInertia.
    if (isDynamic) {
      this.collisionShape.calculateLocalInertia(mass, localInertia);
    }
   
    DefaultMotionState myMotionState = new DefaultMotionState(transform);
   
    RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(
        mass, myMotionState, collisionShape, localInertia);
   
    body = new RigidBody(rbInfo);
View Full Code Here

    BoxShape box = new BoxShape(size);
    Vector3f localInertia = new Vector3f (0,0,0);
    Transform transform = new Transform();
    transform.setIdentity();
    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);
View Full Code Here

        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

      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);
View Full Code Here

        groundTransform.setIdentity();
        groundTransform.origin.set(new Vector3f(floor.getTranslation().getXf(), floor.getTranslation().getYf(), floor.getTranslation().getZf()));
        Vector3f localInertia = new Vector3f(0, 0, 0);
        // let's use DefaultMotionState b/c the floor won't need any movement
        // 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);
View Full Code Here

    localInertia.set(0f, 0f, 0f);
    if (isDynamic) {
      shape.calculateLocalInertia(mass, localInertia);
    }

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

    ownerWorld.addRigidBody(body);
View Full Code Here

TOP

Related Classes of com.bulletphysics.linearmath.DefaultMotionState

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.