Package com.bulletphysics.linearmath

Examples of com.bulletphysics.linearmath.Transform


        ConstraintSolver solver = new SequentialImpulseConstraintSolver();
        dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
        dynamicsWorld.setGravity(new Vector3f(0, -10 /* m/s2 */, 0));
        CollisionShape groundShape = new StaticPlaneShape(new Vector3f(0, 1, 0), 0.25f /* m */);
        CollisionShape ballShape = new SphereShape(3.0f);
        MotionState groundMotionState = new DefaultMotionState(new Transform(new Matrix4f(
                new Quat4f(0, 0, 0, 1),
                new Vector3f(0, 0, 0), 1.0f)));
        RigidBodyConstructionInfo groundBodyConstructionInfo = new RigidBodyConstructionInfo(0, groundMotionState, groundShape, new Vector3f(0, 0, 0));
        groundBodyConstructionInfo.restitution = 0.25f;
        RigidBody groundRigidBody = new RigidBody(groundBodyConstructionInfo);
View Full Code Here


    private static void render() {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        for (RigidBody body : balls) {
            glPushMatrix();
            Vector3f ballPosition = body.getWorldTransform(new Transform()).origin;
            glTranslatef(ballPosition.x, ballPosition.y, ballPosition.z);
            sphere.setDrawStyle(GLU.GLU_SILHOUETTE);
            if (body.equals(controlBall)) {
                glColor4f(0, 1, 0, 1);
            } else {
View Full Code Here

        glLoadIdentity();
        camera.applyTranslations();
        dynamicsWorld.stepSimulation(1.0f / 60.0f);
        Set<RigidBody> ballsToBeRemoved = new HashSet<RigidBody>();
        for (RigidBody body : balls) {
            Vector3f position = body.getMotionState().getWorldTransform(new Transform()).origin;
            if (!body.equals(controlBall) && (position.x < -50 || position.x > 50 || position.z < -50 || position.z > 50)) {
                ballsToBeRemoved.add(body);
            }
        }
        for (RigidBody body : ballsToBeRemoved) {
            balls.remove(body);
            dynamicsWorld.removeRigidBody(body);
        }
        if (applyForce) {
            Transform controlBallTransform = new Transform();
            controlBall.getMotionState().getWorldTransform(controlBallTransform);
            Vector3f controlBallLocation = controlBallTransform.origin;
            Vector3f cameraPosition = new Vector3f(camera.x(), camera.y(), camera.z());
            Vector3f force = new Vector3f();
            force.sub(cameraPosition, controlBallLocation);
            controlBall.activate(true);
            controlBall.applyCentralForce(force);
        }
        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);
View Full Code Here

        PhysicsSphere(Vector4f colour, Vector3f position, DynamicsWorld physicsWorld, float mass, float radius, int slices, int stacks) {
            this.colour = colour;
            this.radius = radius;
            this.slices = slices;
            this.stacks = stacks;
            MotionState motion = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), position, 1.0f)));
            CollisionShape shape = new SphereShape(radius);
            this.physicsBody = new RigidBody(mass, motion, shape);
            this.physicsWorld = physicsWorld;
            this.physicsWorld.addRigidBody(physicsBody);
            this.renderSphere = new org.lwjgl.util.glu.Sphere();
View Full Code Here

        CollisionShape groundShape = new StaticPlaneShape(new Vector3f(0, 1, 0), 0.25f);
        // Initialise 'ballShape' to a sphere with a radius of 3 metres.
        CollisionShape ballShape = new SphereShape(3);
        // Initialise 'groundMotionState' to a motion state that simply assigns the origin [0, 0, 0] as the origin of
        // the ground.
        MotionState groundMotionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(0, 0, 0), 1.0f)));
        // Initialise 'groundBodyConstructionInfo' to a value that contains the mass, the motion state, the shape, and the inertia (= resistance to change).
        RigidBodyConstructionInfo groundBodyConstructionInfo = new RigidBodyConstructionInfo(0, groundMotionState, groundShape, new Vector3f(0, 0, 0));
        // Set the restitution, also known as the bounciness or spring, to 0.25. The restitution may range from 0.0
        // not bouncy) to 1.0 (extremely bouncy).
        groundBodyConstructionInfo.restitution = 0.25f;
        // Initialise 'groundRigidBody', the final variable representing the ground, to a rigid body with the previously
        // assigned construction information.
        RigidBody groundRigidBody = new RigidBody(groundBodyConstructionInfo);
        // Add the ground to the JBullet world.
        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);
View Full Code Here

        // For every physics ball ...
        for (RigidBody body : balls) {
            // Push the model-view matrix.
            glPushMatrix();
            // Retrieve the ball's position from the JBullet body object.
            Vector3f ballPosition = body.getWorldTransform(new Transform()).origin;
            // Translate the model-view to the ball's position.
            glTranslatef(ballPosition.x, ballPosition.y, ballPosition.z);
            // Draw the controllable ball green and the uncontrollable balls red.
            // Set the draw style of the sphere drawing object to GLU_SILHOUETTE.
            // LWJGL JavaDoc: "The legal values are as follows: GLU.FILL: Quadrics are rendered with polygon primitives.
View Full Code Here

        // Create a set of bodies that are to be removed.
        Set<RigidBody> bodiesToBeRemoved = new HashSet<RigidBody>();
        // For every physics ball ...
        for (RigidBody body : balls) {
            // Retrieve the ball's position from the JBullet body object.
            Vector3f position = body.getMotionState().getWorldTransform(new Transform()).origin;
            // If the ball is non-controllable and it is outside the world borders, add it to the set of bodies
            // that are to be removed.
            if (!body.equals(controlBall) && (position.x < -50 || position.x > 50 || position.z < -50 || position.z > 50)) {
                bodiesToBeRemoved.add(body);
            }
        }
        // For every physics ball that is to be removed ...
        for (RigidBody body : bodiesToBeRemoved) {
            // Remove it from the JBullet world.
            dynamicsWorld.removeRigidBody(body);
            // Remove it from the list of balls.
            balls.remove(body);
        }
        // If the attraction between the green ball and the camera is enabled ...
        if (applyForce) {
            // Retrieve the controllable ball's location.
            Transform controlBallTransform = new Transform();
            controlBall.getMotionState().getWorldTransform(controlBallTransform);
            Vector3f controlBallLocation = controlBallTransform.origin;
            Vector3f cameraPosition = new Vector3f(camera.x(), camera.y(), camera.z());
            // Calculate the force that is applied to the controllable ball as following:
            //  force = cameraPosition - controlBallLocation
            Vector3f force = new Vector3f();
            force.sub(cameraPosition, controlBallLocation);
            // Wake the controllable ball if it is sleeping.
            controlBall.activate(true);
            // Apply the force to the controllable ball.
            controlBall.applyCentralForce(force);
        }
        // If a new shape should be created ...
        if (createNewShape) {
            // Create the collision shape (sphere with radius of 3 metres).
            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);
            createNewShape = false;
        }
        // If the controllable ball's position and orientation should be reset ...
        if (resetControlBall) {
            // Set the position of the ball to (0, 50, 0).
            controlBall.setCenterOfMassTransform(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(0, 50, 0), 1.0f)));
            // Reset the angular velocity (spinning movement) of the ball.
            controlBall.setAngularVelocity(new Vector3f(0, 0, 0));
            // Reset the linear velocity (x,y,z movement) of the ball.
            controlBall.setLinearVelocity(new Vector3f(0, 0, 0));
            resetControlBall = false;
View Full Code Here

        PhysicsSphere(Vector4f colour, Vector3f position, DynamicsWorld physicsWorld, float mass, float radius, int slices, int stacks) {
            this.colour = colour;
            this.radius = radius;
            this.slices = slices;
            this.stacks = stacks;
            MotionState motion = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), position, 1.0f)));
            CollisionShape shape = new SphereShape(radius);
            this.physicsBody = new RigidBody(mass, motion, shape);
            this.physicsWorld = physicsWorld;
            this.physicsWorld.addRigidBody(physicsBody);
            this.renderSphere = new org.lwjgl.util.glu.Sphere();
View Full Code Here

    }

    ///////////////////////////// SETTING THE CONSTRAINTS /////////////////////////////////////////////7777
    // Now setup the constraints
    Generic6DofConstraint joint6DOF;
    Transform localA = new Transform(), localB = new Transform();
    boolean useLinearReferenceFrameA = true;
    /// ******* SPINE HEAD ******** ///
    {
      localA.setIdentity();
      localB.setIdentity();

      localA.origin
          .set(0f,
              -(limbLengths[BodyPart.BODYPART_SPINE.ordinal()] + limbLengths[BodyPart.BODYPART_NECK
                  .ordinal()]), 0f);

      localB.origin.set(0f,
          limbLengths[BodyPart.BODYPART_HEAD.ordinal()], 0f);

      joint6DOF = new Generic6DofConstraint(
          bodies[BodyPart.BODYPART_SPINE.ordinal()],
          bodies[BodyPart.BODYPART_HEAD.ordinal()], localA, localB,
          useLinearReferenceFrameA);

      //#ifdef RIGID
      //joint6DOF->setAngularLowerLimit(btVector3(-SIMD_EPSILON,-SIMD_EPSILON,-SIMD_EPSILON));
      //joint6DOF->setAngularUpperLimit(btVector3(SIMD_EPSILON,SIMD_EPSILON,SIMD_EPSILON));
      //#else

      tmp.set(-BulletGlobals.SIMD_PI * 0.2f, -BulletGlobals.FLT_EPSILON,
          -BulletGlobals.SIMD_PI * 0.1f);
      joint6DOF.setAngularLowerLimit(tmp);
      tmp.set(BulletGlobals.SIMD_PI * 0.1f, BulletGlobals.FLT_EPSILON,
          BulletGlobals.SIMD_PI * 0.10f);
      joint6DOF.setAngularUpperLimit(tmp);
      //#endif
      joints[JointType.JOINT_NECK_HEAD.ordinal()] = joint6DOF;
      ownerWorld.addConstraint(
          joints[JointType.JOINT_NECK_HEAD.ordinal()], true);

    }
    /// *************************** ///

    /// ******* PELVIS ******** ///
    {
      localA.setIdentity();
      localB.setIdentity();

      MatrixUtil.setEulerZYX(localA.basis, 0, BulletGlobals.SIMD_HALF_PI,
          0);
      localA.origin.set(0f,
          -limbLengths[BodyPart.BODYPART_PELVIS.ordinal()], 0f);
      MatrixUtil.setEulerZYX(localB.basis, 0, BulletGlobals.SIMD_HALF_PI,
          0);
      localB.origin.set(0f,
          limbLengths[BodyPart.BODYPART_SPINE.ordinal()], 0f);
      joint6DOF = new Generic6DofConstraint(
          bodies[BodyPart.BODYPART_PELVIS.ordinal()],
          bodies[BodyPart.BODYPART_SPINE.ordinal()], localA, localB,
          useLinearReferenceFrameA);

      //#ifdef RIGID
      //joint6DOF->setAngularLowerLimit(btVector3(-SIMD_EPSILON,-SIMD_EPSILON,-SIMD_EPSILON));
      //joint6DOF->setAngularUpperLimit(btVector3(SIMD_EPSILON,SIMD_EPSILON,SIMD_EPSILON));
      //#else
      tmp.set(-BulletGlobals.SIMD_PI * 0.1f, -BulletGlobals.SIMD_EPSILON,
          -BulletGlobals.SIMD_PI * 0.1f);
      joint6DOF.setAngularLowerLimit(tmp);
      tmp.set(BulletGlobals.SIMD_PI * 0.2f, BulletGlobals.SIMD_EPSILON,
          BulletGlobals.SIMD_PI * 0.15f);
      joint6DOF.setAngularUpperLimit(tmp);
      //#endif
      joints[JointType.JOINT_PELVIS_SPINE.ordinal()] = joint6DOF;
      ownerWorld.addConstraint(
          joints[JointType.JOINT_PELVIS_SPINE.ordinal()], true);
    }
    /// *************************** ///

    /// ******* SPINE 2D ******** ///
    {
      localA.setIdentity();
      localB.setIdentity();

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

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

      CollisionShape ZeroShape = null;
      GLOBAL.jBullet.ZeroBody = new RigidBody(0.0f, null, ZeroShape);

      Transform Rotation = new Transform();
      Rotation.setIdentity();
      GLOBAL.jBullet.ZeroBody.setWorldTransform(Rotation);

      joint6DOF = new Generic6DofConstraint(
          bodies[BodyPart.BODYPART_SPINE.ordinal()],
          GLOBAL.jBullet.ZeroBody, localA, localB, false);
View Full Code Here

  void makeBody(DynamicsWorld ownerWorld, Vector3f positionOffset,
      float scale_ragdoll) {

    this.buildScale = scale_ragdoll;
    Transform tmpTrans = new Transform();
    Vector3f tmp = new Vector3f();
    // Setup the geometry
    int partNum = 0;
    this.buildProportions();

    // Setup some damping on the m_bodies
    for (int i = 0; i < BodyPart.BODYPART_COUNT.ordinal(); ++i) {
      shapes[i] = new CapsuleShape(limbWidths[i], limbLengths[i]);
    }

    // Setup all the rigid bodies
    Transform offset = new Transform();
    offset.setIdentity();
    offset.origin.set(positionOffset);

    Transform transform = new Transform();

    transform.setIdentity();
    transform.origin.set(42.00441f, 28.350739f, -1.8362772f);
    tmpTrans.mul(offset, transform);
    bodies[BodyPart.BODYPART_HEAD.ordinal()] = localCreateRigidBody(
        .06f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_HEAD.ordinal()]);

    transform.setIdentity();
    transform.origin.set(40.328167f, 34.438187f, -0.02232361f);
    tmpTrans.mul(offset, transform);
    bodies[BodyPart.BODYPART_SPINE.ordinal()] = localCreateRigidBody(
        1f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_SPINE.ordinal()]);

    transform.setIdentity();
    transform.origin.set(38.91143f, 39.836838f, 0.29198787f);

    tmpTrans.mul(offset, transform);

    bodies[BodyPart.BODYPART_PELVIS.ordinal()] = localCreateRigidBody(
        1f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_PELVIS.ordinal()]);

    //  transform.setIdentity();
    //  transform.origin.set(0f, scale_ragdoll * -1.6f, 0f);
    //  tmpTrans.mul(offset, transform);
    //  bodies[BodyPart.BODYPART_NECK.ordinal()] = localCreateRigidBody(.1f, tmpTrans, shapes[BodyPart.BODYPART_NECK.ordinal()]);

    if (this.hasArms) {
      transform.setIdentity();
      transform.origin.set(41.880104f, 33.694458f, 2.016673f);

      MatrixUtil.setEulerZYX(transform.basis,
          -BulletGlobals.SIMD_HALF_PI, 0, 0);
      tmpTrans.mul(offset, transform);
      bodies[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()] = localCreateRigidBody(
          .006f * this.mass, tmpTrans,
          shapes[BodyPart.BODYPART_LEFT_UPPER_ARM.ordinal()]);

      transform.setIdentity();
      transform.origin.set(42.41656f, 37.918385f, 0.61924f);

      MatrixUtil.setEulerZYX(transform.basis,
          -BulletGlobals.SIMD_HALF_PI, 0, 0);
      tmpTrans.mul(offset, transform);
      bodies[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()] = localCreateRigidBody(
          .006f * this.mass, tmpTrans,
          shapes[BodyPart.BODYPART_LEFT_LOWER_ARM.ordinal()]);

      transform.setIdentity();
      transform.origin.set(42.514267f, 33.331062f, -3.8124154f);

      MatrixUtil.setEulerZYX(transform.basis,
          -BulletGlobals.SIMD_HALF_PI, 0, 0);
      tmpTrans.mul(offset, transform);
      bodies[BodyPart.BODYPART_LEFT_HAND.ordinal()] = localCreateRigidBody(
          .006f * this.mass, tmpTrans,
          shapes[BodyPart.BODYPART_LEFT_HAND.ordinal()]);

      transform.setIdentity();
      transform.setIdentity();
      transform.origin.set(39.261406f, 46.36395f, 2.412697f);

      MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_HALF_PI,
          0, 0);
      tmpTrans.mul(offset, transform);
      bodies[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()] = localCreateRigidBody(
          .006f * this.mass, tmpTrans,
          shapes[BodyPart.BODYPART_RIGHT_UPPER_ARM.ordinal()]);

      transform.setIdentity();
      transform.origin.set(39.526512f, 54.545227f, 2.1793346f);

      MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_HALF_PI,
          0, 0);
      tmpTrans.mul(offset, transform);
      bodies[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()] = localCreateRigidBody(
          .006f * this.mass, tmpTrans,
          shapes[BodyPart.BODYPART_RIGHT_LOWER_ARM.ordinal()]);

      transform.setIdentity();
      transform.origin.set(42.192146f, 40.39129f, -1.8401904f);

      MatrixUtil.setEulerZYX(transform.basis, BulletGlobals.SIMD_HALF_PI,
          0, 0);
      tmpTrans.mul(offset, transform);
      bodies[BodyPart.BODYPART_RIGHT_HAND.ordinal()] = localCreateRigidBody(
          .006f * this.mass, tmpTrans,
          shapes[BodyPart.BODYPART_RIGHT_HAND.ordinal()]);

    }

    //LEFT LEG
    transform.setIdentity();
    transform.origin.set(39.261406f, 46.36395f, 2.412697f);

    tmpTrans.mul(offset, transform);
    bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()] = localCreateRigidBody(
        1.2f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()]);

    transform.setIdentity();
    transform.origin.set(39.526512f, 54.545227f, 2.1793346f);

    tmpTrans.mul(offset, transform);
    bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()] = localCreateRigidBody(
        .6f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()]);

    transform.setIdentity();
    transform.origin.set(39.758045f, 59.2257f, 2.0889432f);

    tmpTrans.mul(offset, transform);
    bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()] = localCreateRigidBody(
        .6f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_LEFT_FOOT.ordinal()]);

    //RIGHT LEG
    transform.setIdentity();
    transform.origin.set(39.261406f, 46.36395f, -2.412697f);
    tmpTrans.mul(offset, transform);
    bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()] = localCreateRigidBody(
        1.2f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()]);

    transform.setIdentity();
    transform.origin.set(39.526512f, 54.545227f, -2.1793346f);

    tmpTrans.mul(offset, transform);
    bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()] = localCreateRigidBody(
        .6f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()]);

    transform.setIdentity();
    transform.origin.set(39.758045f, 59.2257f, -2.0889432f);
    tmpTrans.mul(offset, transform);
    bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()] = localCreateRigidBody(
        0.6f * this.mass, tmpTrans,
        shapes[BodyPart.BODYPART_RIGHT_FOOT.ordinal()]);

   
   
    //Remembered positions
    //BODYPART_HEAD
    bodies[BodyPart.BODYPART_HEAD.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.set(new Matrix4f(0.999522f, -0.02457619f, 0.01875775f,
        103.311295f, 0.03083701f, 0.83602184f, -0.547829f,
        22.693146f * this.scale, -0.0022183368f, 0.5481455f, 0.83638f,
        -1.0370132f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_HEAD.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_SPINE
    bodies[BodyPart.BODYPART_SPINE.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.9932064f, 0.116363324f, 7.786779E-4f,
        104.067566f, -0.1162641f, 0.99203515f, 0.04846615f,
        31.873365f * this.scale, 0.004867207f, -0.048227426f,
        0.99882454f, 0.0021075667f * this.scale, 0.0f, 0.0f, 0.0f,
        1.0f * this.scale));
    bodies[BodyPart.BODYPART_SPINE.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_PELVIS
    bodies[BodyPart.BODYPART_PELVIS.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.9835286f, 0.17898695f, -0.025202362f,
        105.264946f, -0.18059899f, 0.97884035f, -0.09620573f,
        40.34729f * this.scale, 0.007449517f, 0.099172615f, 0.9950424f,
        0.04683579f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_PELVIS.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_LEFT_UPPER_LEG
    bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.29188365f, 0.9564537f, -4.4153258E-4f,
        109.79127f, -0.9526396f, 0.29067844f, -0.0893526f,
        44.345417f * this.scale, -0.08533329f, 0.026501186f,
        0.99599993f, 3.9808998f * this.scale, 0.0f, 0.0f, 0.0f,
        1.0f * this.scale));
    bodies[BodyPart.BODYPART_LEFT_UPPER_LEG.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_LEFT_LOWER_LEG
    bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.9873329f, -0.15865491f, 0.0015572663f,
        115.62421f, 0.15813647f, 0.98321307f, -0.09102161f,
        52.051834f * this.scale, 0.012909901f, 0.09011489f, 0.9958477f,
        4.6894903f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_LEFT_LOWER_LEG.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //RIGHT_UPPER_LEG
    bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.23838913f, 0.9675928f, -0.08327571f,
        110.01697f, -0.9671425f, 0.22872531f, -0.110996194f,
        44.76596f * this.scale, -0.08835185f, 0.10699976f, 0.9903257f,
        -2.6929f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_RIGHT_UPPER_LEG.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_RIGHT_LOWER_LEG
    bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.9864584f, -0.14225316f, -0.081632055f,
        116.022156f, 0.13265687f, 0.98470926f, -0.11291519f,
        52.043633f * this.scale, 0.09644639f, 0.10055709f, 0.9902456f,
        -1.3562305f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_RIGHT_LOWER_LEG.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_RIGHT_FOOT
    bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(0.00923717f, 0.9967484f, -0.080045804f,
        116.96003f, -0.99355465f, 1.0448694E-4f, -0.11335374f,
        57.707912f * this.scale, -0.11297679f, 0.08057695f, 0.990325f,
        -0.6338565f * this.scale, 0.0f, 0.0f, 0.0f, 1.0f * this.scale));
    bodies[BodyPart.BODYPART_RIGHT_FOOT.ordinal()]
        .setMotionState(new DefaultMotionState(transform));

    //BODYPART_LEFT_FOOT
    bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()].getMotionState()
        .getWorldTransform(transform);
    transform.setIdentity();
    transform.set(new Matrix4f(-3.4880638E-4f, 0.99999404f, 0.0034378879f,
        116.47286f, -0.9958018f, -3.2663345E-5f, -0.09153569f,
        57.707455f * this.scale, -0.09153503f, -0.0034553856f,
        0.99579585f, 5.203514f * this.scale, 0.0f, 0.0f, 0.0f,
        1.0f * this.scale));
    bodies[BodyPart.BODYPART_LEFT_FOOT.ordinal()]
 
View Full Code Here

TOP

Related Classes of com.bulletphysics.linearmath.Transform

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.