Examples of RigidBodyConstructionInfo


Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

    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);
    this.body = body;
   
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

        startTransform.setIdentity();
        startTransform.origin.set(box.getTranslation().getXf(), box.getTranslation().getYf(), box.getTranslation().getZf());
        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);
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

        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);
        // add the floor to the world
        world.addRigidBody(body);
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

    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

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

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

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

    ownerWorld.addRigidBody(body);

    return body;
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

    //#define USE_MOTIONSTATE 1
    //#ifdef USE_MOTIONSTATE
    DefaultMotionState myMotionState = new DefaultMotionState(startTransform);
   
    RigidBodyConstructionInfo cInfo = new RigidBodyConstructionInfo(mass, myMotionState, shape, localInertia);
   
    RigidBody body = new RigidBody(cInfo);
    //#else
    //btRigidBody* body = new btRigidBody(mass,0,shape,localInertia); 
    //body->setWorldTransform(startTransform);
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

      }

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

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

        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 few dynamic rigidbodies
      // Re-using the same collision is better for memory usage and performance

      CollisionShape colShape = new BoxShape(new Vector3f(1, 1, 1));
      //CollisionShape colShape = new SphereShape(1f);
      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);
      }

      float start_x = START_POS_X - ARRAY_SIZE_X / 2;
      float start_y = START_POS_Y;
      float start_z = START_POS_Z - ARRAY_SIZE_Z / 2;

      for (int k = 0; k < ARRAY_SIZE_Y; k++) {
        for (int i = 0; i < ARRAY_SIZE_X; i++) {
          for (int j = 0; j < ARRAY_SIZE_Z; j++) {
            startTransform.origin.set(
                2f * i + start_x,
                10f + 2f * k + start_y,
                2f * j + start_z);

            // 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);
            body.setActivationState(RigidBody.ISLAND_SLEEPING);

            dynamicsWorld.addRigidBody(body);
            body.setActivationState(RigidBody.ISLAND_SLEEPING);
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

        VoxelWorldShape liquidShape = new VoxelWorldShape(liquidWrapper);

        Matrix3f rot = new Matrix3f();
        rot.setIdentity();
        DefaultMotionState blockMotionState = new DefaultMotionState(new Transform(new Matrix4f(rot, new Vector3f(0, 0, 0), 1.0f)));
        RigidBodyConstructionInfo blockConsInf = new RigidBodyConstructionInfo(0, blockMotionState, worldShape, new Vector3f());
        BulletRigidBody rigidBody = new BulletRigidBody(blockConsInf);
        rigidBody.rb.setCollisionFlags(CollisionFlags.STATIC_OBJECT | rigidBody.rb.getCollisionFlags());
        short mask = (short) (~(CollisionFilterGroups.STATIC_FILTER | StandardCollisionGroup.LIQUID.getFlag()));
        discreteDynamicsWorld.addRigidBody(rigidBody.rb, combineGroups(StandardCollisionGroup.WORLD), mask);

        RigidBodyConstructionInfo liquidConsInfo = new RigidBodyConstructionInfo(0, blockMotionState, liquidShape, new Vector3f());
        BulletRigidBody liquidBody = new BulletRigidBody(liquidConsInfo);
        liquidBody.rb.setCollisionFlags(CollisionFlags.STATIC_OBJECT | rigidBody.rb.getCollisionFlags());
        discreteDynamicsWorld.addRigidBody(liquidBody.rb, combineGroups(StandardCollisionGroup.LIQUID),
                CollisionFilterGroups.SENSOR_TRIGGER);
    }
View Full Code Here

Examples of com.bulletphysics.dynamics.RigidBodyConstructionInfo

                        "Entity: {}", entity);
            }
            Vector3f fallInertia = new Vector3f();
            shape.calculateLocalInertia(rigidBody.mass, fallInertia);

            RigidBodyConstructionInfo info = new RigidBodyConstructionInfo(rigidBody.mass, new EntityMotionState(entity), shape, fallInertia);
            BulletRigidBody collider = new BulletRigidBody(info);
            collider.rb.setUserPointer(entity);
            collider.rb.setAngularFactor(rigidBody.angularFactor);
            collider.rb.setLinearFactor(rigidBody.linearFactor);
            collider.rb.setFriction(rigidBody.friction);
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.