Package com.bulletphysics.linearmath

Examples of com.bulletphysics.linearmath.Transform


  }

  public void shootBox(Vector3f destination) {
    if (dynamicsWorld != null) {
      float mass = 10f;
      Transform startTransform = new Transform();
      startTransform.setIdentity();
      Vector3f camPos = new Vector3f(getCameraPosition());
      startTransform.origin.set(camPos);

      if (shootBoxShape == null) {
        //#define TEST_UNIFORM_SCALING_SHAPE 1
        //#ifdef TEST_UNIFORM_SCALING_SHAPE
        //btConvexShape* childShape = new btBoxShape(btVector3(1.f,1.f,1.f));
        //m_shootBoxShape = new btUniformScalingShape(childShape,0.5f);
        //#else
        shootBoxShape = new BoxShape(new Vector3f(1f, 1f, 1f));
        //#endif//
      }

      RigidBody body = this.localCreateRigidBody(mass, startTransform, shootBoxShape);

      Vector3f linVel = new Vector3f(destination.x - camPos.x, destination.y - camPos.y, destination.z - camPos.z);
      linVel.normalize();
      linVel.scale(ShootBoxInitialSpeed);

      Transform worldTrans = body.getWorldTransform(new Transform());
      worldTrans.origin.set(camPos);
      worldTrans.setRotation(new Quat4f(0f, 0f, 0f, 1f));
      body.setWorldTransform(worldTrans);
     
      body.setLinearVelocity(linVel);
      body.setAngularVelocity(new Vector3f(0f, 0f, 0f));

View Full Code Here


    Matrix3f tmpMat2 = Stack.alloc(Matrix3f.class);
    Vector3f tmp1 = Stack.alloc(Vector3f.class);
    Vector3f tmp2 = Stack.alloc(Vector3f.class);
    Vector3f tmpVec = Stack.alloc(Vector3f.class);
   
    Transform centerOfMassA = rbA.getCenterOfMassTransform(Stack.alloc(Transform.class));
    Transform centerOfMassB = rbB.getCenterOfMassTransform(Stack.alloc(Transform.class));

    for (int i = 0; i < 3; i++) {
      VectorUtil.setCoord(normal, i, 1f);

      tmpMat1.transpose(centerOfMassA.basis);
      tmpMat2.transpose(centerOfMassB.basis);

      tmp1.set(pivotInA);
      centerOfMassA.transform(tmp1);
      tmp1.sub(rbA.getCenterOfMassPosition(tmpVec));

      tmp2.set(pivotInB);
      centerOfMassB.transform(tmp2);
      tmp2.sub(rbB.getCenterOfMassPosition(tmpVec));

      jac[i].init(
          tmpMat1,
          tmpMat2,
View Full Code Here

  public void solveConstraint(float timeStep) {
    Vector3f tmp = Stack.alloc(Vector3f.class);
    Vector3f tmp2 = Stack.alloc(Vector3f.class);
    Vector3f tmpVec = Stack.alloc(Vector3f.class);

    Transform centerOfMassA = rbA.getCenterOfMassTransform(Stack.alloc(Transform.class));
    Transform centerOfMassB = rbB.getCenterOfMassTransform(Stack.alloc(Transform.class));
   
    Vector3f pivotAInW = Stack.alloc(pivotInA);
    centerOfMassA.transform(pivotAInW);

    Vector3f pivotBInW = Stack.alloc(pivotInB);
    centerOfMassB.transform(pivotBInW);

    Vector3f normal = Stack.alloc(Vector3f.class);
    normal.set(0f, 0f, 0f);

    //btVector3 angvelA = m_rbA.getCenterOfMassTransform().getBasis().transpose() * m_rbA.getAngularVelocity();
 
View Full Code Here

  }
 
  // internal
 
  public void buildJacobianInt(RigidBody rbA, RigidBody rbB, Transform frameInA, Transform frameInB) {
    Transform tmpTrans = Stack.alloc(Transform.class);
    Transform tmpTrans1 = Stack.alloc(Transform.class);
    Transform tmpTrans2 = Stack.alloc(Transform.class);
    Vector3f tmp = Stack.alloc(Vector3f.class);
    Vector3f tmp2 = Stack.alloc(Vector3f.class);

    // calculate transforms
    calculatedTransformA.mul(rbA.getCenterOfMassTransform(tmpTrans), frameInA);
View Full Code Here

  }
 
  // shared code used by ODE solver
 
  public void calculateTransforms() {
    Transform tmpTrans = Stack.alloc(Transform.class);

    if (useLinearReferenceFrameA) {
      calculatedTransformA.mul(rbA.getCenterOfMassTransform(tmpTrans), frameInA);
      calculatedTransformB.mul(rbB.getCenterOfMassTransform(tmpTrans), frameInB);
    }
View Full Code Here

  }
 
  // access for PE Solver
 
  public Vector3f getAncorInA(Vector3f out) {
    Transform tmpTrans = Stack.alloc(Transform.class);

    Vector3f ancorInA = out;
    ancorInA.scaleAdd((lowerLinLimit + upperLinLimit) * 0.5f, sliderAxis, realPivotAInW);
    rbA.getCenterOfMassTransform(tmpTrans);
    tmpTrans.inverse();
    tmpTrans.transform(ancorInA);
    return ancorInA;
  }
View Full Code Here

  //    }
  //
  //    END_PROFILE("refreshManifolds");
  //  //#endif //FORCE_REFESH_CONTACT_MANIFOLDS

      Transform tmpTrans = Stack.alloc(Transform.class);

      //int sizeofSB = sizeof(btSolverBody);
      //int sizeofSC = sizeof(btSolverConstraint);

      //if (1)
View Full Code Here

  public void reset() {
  }

  public void warp(Vector3f origin) {
    Transform xform = Stack.alloc(Transform.class);
    xform.setIdentity();
    xform.origin.set(origin);
    ghostObject.setWorldTransform(xform);
  }
View Full Code Here

    {
      verticalVelocity = -Math.abs(fallSpeed);
    }
    verticalOffset = verticalVelocity * dt;

    Transform xform = ghostObject.getWorldTransform(Stack.alloc(Transform.class));

    //printf("walkDirection(%f,%f,%f)\n",walkDirection[0],walkDirection[1],walkDirection[2]);
    //printf("walkSpeed=%f\n",walkSpeed);

    stepUp(collisionWorld);
View Full Code Here

        //manifold->clearManifold();
      }
    }
   
    Transform newTrans = ghostObject.getWorldTransform(Stack.alloc(Transform.class));
    newTrans.origin.set(currentPosition);
    ghostObject.setWorldTransform(newTrans);
    //printf("m_touchingNormal = %f,%f,%f\n",m_touchingNormal[0],m_touchingNormal[1],m_touchingNormal[2]);

    //System.out.println("recoverFromPenetration "+penetration+" "+touchingNormal);
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.