Examples of calculateLocalInertia()


Examples of com.bulletphysics.collision.shapes.BoxShape.calculateLocalInertia()

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

Examples of com.bulletphysics.collision.shapes.BoxShape.calculateLocalInertia()

        Vector3f halfExtents = new Vector3f((float) box.getXExtent(),
                (float) box.getYExtent(), (float) box.getZExtent());
        BoxShape shape = new BoxShape(halfExtents);
        // fix local inertia
        Vector3f localInertia = new Vector3f(0, 0, 0);
        shape.calculateLocalInertia(mass, localInertia);
        // set initial transform based on box
        Transform startTransform = new Transform();
        startTransform.setIdentity();
        startTransform.origin.set(box.getTranslation().getXf(), box.getTranslation().getYf(), box.getTranslation().getZf());
        MotionStateBind motionState = new MotionStateBind(startTransform);
View Full Code Here

Examples of com.bulletphysics.collision.shapes.BoxShape.calculateLocalInertia()

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

Examples of com.bulletphysics.collision.shapes.BoxShape.calculateLocalInertia()

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

Examples of com.bulletphysics.collision.shapes.BoxShape.calculateLocalInertia()

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

Examples of com.bulletphysics.collision.shapes.CollisionShape.calculateLocalInertia()

        groundBodyConstructionInfo.restitution = 0.25f;
        RigidBody groundRigidBody = new RigidBody(groundBodyConstructionInfo);
        dynamicsWorld.addRigidBody(groundRigidBody);
        MotionState ballMotionState = new DefaultMotionState(DEFAULT_BALL_TRANSFORM);
        Vector3f ballInertia = new Vector3f(0, 0, 0);
        ballShape.calculateLocalInertia(2.5f, ballInertia);
        RigidBodyConstructionInfo ballConstructionInfo = new RigidBodyConstructionInfo(2.5f, ballMotionState, ballShape, ballInertia);
        ballConstructionInfo.restitution = 0.5f;
        ballConstructionInfo.angularDamping = 0.95f;
        controlBall = new RigidBody(ballConstructionInfo);
        controlBall.setActivationState(CollisionObject.DISABLE_DEACTIVATION);
View Full Code Here

Examples of com.bulletphysics.collision.shapes.CollisionShape.calculateLocalInertia()

        }
        if (createNewShape) {
            CollisionShape shape = new SphereShape(3.0f);
            DefaultMotionState motionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(camera.x(), 35, camera.z()), 1)));
            Vector3f inertia = new Vector3f();
            shape.calculateLocalInertia(1.0f, inertia);
            RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(1.0f, motionState, shape, inertia);
            constructionInfo.restitution = 0.75f;
            RigidBody body = new RigidBody(constructionInfo);
            dynamicsWorld.addRigidBody(body);
            balls.add(body);
View Full Code Here

Examples of com.bulletphysics.collision.shapes.CollisionShape.calculateLocalInertia()

        dynamicsWorld.addRigidBody(groundRigidBody);
        // Initialise 'ballMotion' to a motion state that assigns a specified location to the ball.
        MotionState ballMotion = new DefaultMotionState(new Transform(DEFAULT_BALL_TRANSFORM));
        // Calculate the ball's inertia (resistance to movement) using its mass (2.5 kilograms).
        Vector3f ballInertia = new Vector3f(0, 0, 0);
        ballShape.calculateLocalInertia(2.5f, ballInertia);
        // Composes the ball's construction info of its mass, its motion state, its shape, and its inertia.
        RigidBodyConstructionInfo ballConstructionInfo = new RigidBodyConstructionInfo(2.5f, ballMotion, ballShape, ballInertia);
        // Set the restitution, also known as the bounciness or spring, to 0.5. The restitution may range from 0.0
        // not bouncy) to 1.0 (extremely bouncy).
        ballConstructionInfo.restitution = 0.5f;
View Full Code Here

Examples of com.bulletphysics.collision.shapes.CollisionShape.calculateLocalInertia()

            CollisionShape shape = new SphereShape(3);
            // Create the motion state (x and z are the same as the camera's).
            DefaultMotionState motionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(camera.x(), 35, camera.z()), 1.0f)));
            // Calculate the inertia (resistance to movement) using the ball's mass of 1 kilogram.
            Vector3f inertia = new Vector3f(0, 0, 0);
            shape.calculateLocalInertia(1.0f, inertia);
            RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(1, motionState, shape, inertia);
            constructionInfo.restitution = 0.75f;
            RigidBody rigidBody = new RigidBody(constructionInfo);
            balls.add(rigidBody);
            dynamicsWorld.addRigidBody(rigidBody);
View Full Code Here

Examples of com.bulletphysics.collision.shapes.CollisionShape.calculateLocalInertia()

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