Package com.bulletphysics.linearmath

Examples of com.bulletphysics.linearmath.Transform


  private class BspToBulletConverter extends BspConverter {
    @Override
    public void addConvexVerticesCollider(ObjectArrayList<Vector3f> vertices) {
      if (vertices.size() > 0) {
        float mass = 0f;
        Transform startTransform = new Transform();
        // can use a shift
        startTransform.setIdentity();
        // JAVA NOTE: port change, we want y to be up.
        startTransform.basis.rotX((float) -Math.PI / 2f);
        startTransform.origin.set(0, -10, 0);
        //startTransform.origin.set(0, 0, -10f);
       
View Full Code Here


   
    Vector3f tmp = Stack.alloc(Vector3f.class);

    currentVehicleSpeedKmHour = 3.6f * getRigidBody().getLinearVelocity(tmp).length();

    Transform chassisTrans = getChassisWorldTransform(Stack.alloc(Transform.class));

    Vector3f forwardW = Stack.alloc(Vector3f.class);
    forwardW.set(
        chassisTrans.basis.getElement(0, indexForwardAxis),
        chassisTrans.basis.getElement(1, indexForwardAxis),
        chassisTrans.basis.getElement(2, indexForwardAxis));

    if (forwardW.dot(getRigidBody().getLinearVelocity(tmp)) < 0f) {
      currentVehicleSpeedKmHour *= -1f;
    }

    //
    // simulate suspension
    //

    int i = 0;
    for (i = 0; i < wheelInfo.size(); i++) {
      float depth;
      depth = rayCast(wheelInfo.getQuick(i));
    }

    updateSuspension(step);

    for (i = 0; i < wheelInfo.size(); i++) {
      // apply suspension force
      WheelInfo wheel = wheelInfo.getQuick(i);

      float suspensionForce = wheel.wheelsSuspensionForce;

      if (suspensionForce > wheel.maxSuspensionForce) {
        suspensionForce = wheel.maxSuspensionForce;
      }
      Vector3f impulse = Stack.alloc(Vector3f.class);
      impulse.scale(suspensionForce * step, wheel.raycastInfo.contactNormalWS);
      Vector3f relpos = Stack.alloc(Vector3f.class);
      relpos.sub(wheel.raycastInfo.contactPointWS, getRigidBody().getCenterOfMassPosition(tmp));

      getRigidBody().applyImpulse(impulse, relpos);
    }

    updateFriction(step);

    for (i = 0; i < wheelInfo.size(); i++) {
      WheelInfo wheel = wheelInfo.getQuick(i);
      Vector3f relpos = Stack.alloc(Vector3f.class);
      relpos.sub(wheel.raycastInfo.hardPointWS, getRigidBody().getCenterOfMassPosition(tmp));
      Vector3f vel = getRigidBody().getVelocityInLocalPoint(relpos, Stack.alloc(Vector3f.class));

      if (wheel.raycastInfo.isInContact) {
        Transform chassisWorldTransform = getChassisWorldTransform(Stack.alloc(Transform.class));

        Vector3f fwd = Stack.alloc(Vector3f.class);
        fwd.set(
            chassisWorldTransform.basis.getElement(0, indexForwardAxis),
            chassisWorldTransform.basis.getElement(1, indexForwardAxis),
View Full Code Here

      sideImpulse.set(i, 0f);
      forwardImpulse.set(i, 0f);
    }

    {
      Transform wheelTrans = Stack.alloc(Transform.class);
      for (int i = 0; i < getNumWheels(); i++) {

        WheelInfo wheel_info = wheelInfo.getQuick(i);

        RigidBody groundObject = (RigidBody) wheel_info.raycastInfo.groundObject;
View Full Code Here

  /**
   * Worldspace forward vector.
   */
  public Vector3f getForwardVector(Vector3f out) {
    Transform chassisTrans = getChassisWorldTransform(Stack.alloc(Transform.class));

    out.set(
        chassisTrans.basis.getElement(0, indexForwardAxis),
        chassisTrans.basis.getElement(1, indexForwardAxis),
        chassisTrans.basis.getElement(2, indexForwardAxis));
View Full Code Here

    }
   
    if (getDebugDrawer() != null && (getDebugDrawer().getDebugMode() & (DebugDrawModes.DRAW_WIREFRAME | DebugDrawModes.DRAW_AABB)) != 0) {
      int i;

      Transform tmpTrans = Stack.alloc(Transform.class);
      Vector3f minAabb = Stack.alloc(Vector3f.class);
      Vector3f maxAabb = Stack.alloc(Vector3f.class);
      Vector3f colorvec = Stack.alloc(Vector3f.class);
     
      // todo: iterate over awake simulation islands!
View Full Code Here

      }
    }
  }

  protected void synchronizeMotionStates() {
    Transform interpolatedTransform = Stack.alloc(Transform.class);
   
    Transform tmpTrans = Stack.alloc(Transform.class);
    Vector3f tmpLinVel = Stack.alloc(Vector3f.class);
    Vector3f tmpAngVel = Stack.alloc(Vector3f.class);

    // todo: iterate over awake simulation islands!
    for (int i = 0; i < collisionObjects.size(); i++) {
View Full Code Here

  protected void integrateTransforms(float timeStep) {
    BulletStats.pushProfile("integrateTransforms");
    try {
      Vector3f tmp = Stack.alloc(Vector3f.class);
      Transform tmpTrans = Stack.alloc(Transform.class);

      Transform predictedTrans = Stack.alloc(Transform.class);
      for (int i=0; i<collisionObjects.size(); i++) {
        CollisionObject colObj = collisionObjects.getQuick(i);
        RigidBody body = RigidBody.upcast(colObj);
        if (body != null) {
          body.setHitFraction(1f);
View Full Code Here

  }
 
  protected void predictUnconstraintMotion(float timeStep) {
    BulletStats.pushProfile("predictUnconstraintMotion");
    try {
      Transform tmpTrans = Stack.alloc(Transform.class);
     
      for (int i = 0; i < collisionObjects.size(); i++) {
        CollisionObject colObj = collisionObjects.getQuick(i);
        RigidBody body = RigidBody.upcast(colObj);
        if (body != null) {
View Full Code Here

    this.constraintSolver = constraintSolver;
    this.ownsConstraintSolver = false;
  }

  protected void predictUnconstraintMotion(float timeStep) {
    Transform tmpTrans = Stack.alloc(Transform.class);
   
    for (int i = 0; i < collisionObjects.size(); i++) {
      CollisionObject colObj = collisionObjects.getQuick(i);
      RigidBody body = RigidBody.upcast(colObj);
      if (body != null) {
View Full Code Here

      }
    }
  }
 
  protected void integrateTransforms(float timeStep) {
    Transform predictedTrans = Stack.alloc(Transform.class);
    for (int i = 0; i < collisionObjects.size(); i++) {
      CollisionObject colObj = collisionObjects.getQuick(i);
      RigidBody body = RigidBody.upcast(colObj);
      if (body != null) {
        if (body.isActive() && (!body.isStaticObject())) {
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.