Package com.bulletphysics.linearmath

Examples of com.bulletphysics.linearmath.Transform


    return penetration;
  }
 
  protected void stepUp(CollisionWorld world) {
    // phase 1: up
    Transform start = Stack.alloc(Transform.class);
    Transform end = Stack.alloc(Transform.class);
    targetPosition.scaleAdd(stepHeight + (verticalOffset > 0.0?verticalOffset:0.0f), upAxisDirection[upAxis], currentPosition);

    start.setIdentity ();
    end.setIdentity ();

    /* FIXME: Handle penetration properly */
    start.origin.scaleAdd(convexShape.getMargin() + addedMargin, upAxisDirection[upAxis], currentPosition);
    end.origin.set(targetPosition);
   
View Full Code Here


  protected void stepForwardAndStrafe(CollisionWorld collisionWorld, Vector3f walkMove) {
    // printf("m_normalizedDirection=%f,%f,%f\n",
    //   m_normalizedDirection[0],m_normalizedDirection[1],m_normalizedDirection[2]);
    // phase 2: forward and strafe
    Transform start = Stack.alloc(Transform.class);
    Transform end = Stack.alloc(Transform.class);
    targetPosition.add(currentPosition, walkMove);
    start.setIdentity ();
    end.setIdentity ();

    float fraction = 1.0f;
    Vector3f distance2Vec = Stack.alloc(Vector3f.class);
    distance2Vec.sub(currentPosition, targetPosition);
    float distance2 = distance2Vec.lengthSquared();
View Full Code Here

      //    break;
    }
  }

  protected void stepDown(CollisionWorld collisionWorld, float dt) {
    Transform start = Stack.alloc(Transform.class);
    Transform end = Stack.alloc(Transform.class);

    // phase 3: down
//    float additionalDownStep = (wasOnGround /*&& !onGround()*/) ? stepHeight : 0.0f;
//    Vector3f step_drop = Stack.alloc(Vector3f.class);
//    step_drop.scale(currentStepOffset + additionalDownStep, upAxisDirection[upAxis]);
//    float downVelocity = (additionalDownStep == 0.0f && verticalVelocity<0.0f?-verticalVelocity:0.0f) * dt;
//    Vector3f gravity_drop = Stack.alloc(Vector3f.class);
//    gravity_drop.scale(downVelocity, upAxisDirection[upAxis]);
//    targetPosition.sub(step_drop);
//    targetPosition.sub(gravity_drop);
               
                float downVelocity = (verticalVelocity<0.0f?-verticalVelocity:0.0f) * dt;
                if(downVelocity > 0.0 && downVelocity < stepHeight
      && (wasOnGround || !wasJumping))
    {
      downVelocity = stepHeight;
    }
                Vector3f step_drop = Stack.alloc(Vector3f.class);
                step_drop.scale(currentStepOffset + downVelocity, upAxisDirection[upAxis]);
    targetPosition.sub(step_drop);

    start.setIdentity ();
    end.setIdentity ();

    start.origin.set(currentPosition);
    end.origin.set(targetPosition);

    KinematicClosestNotMeConvexResultCallback callback = new KinematicClosestNotMeConvexResultCallback(ghostObject, upAxisDirection[upAxis], maxSlopeCosine);
View Full Code Here

    if (invMass != 0f) {
      originalBody.setLinearVelocity(linearVelocity);
      originalBody.setAngularVelocity(angularVelocity);

      // correct the position/orientation based on push/turn recovery
      Transform newTransform = Stack.alloc(Transform.class);
      Transform curTrans = originalBody.getWorldTransform(Stack.alloc(Transform.class));
      TransformUtil.integrateTransform(curTrans, pushVelocity, turnVelocity, timeStep, newTransform);
      originalBody.setWorldTransform(newTransform);

      //m_originalBody->setCompanionId(-1);
    }
View Full Code Here

  public void buildJacobian() {
    Vector3f tmp = Stack.alloc(Vector3f.class);
    Vector3f tmp1 = Stack.alloc(Vector3f.class);
    Vector3f tmp2 = Stack.alloc(Vector3f.class);

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

    appliedImpulse = 0f;

    // set bias, sign, clear accumulator
    swingCorrection = 0f;
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 tmpTrans = Stack.alloc(Transform.class);

    Vector3f pivotAInW = Stack.alloc(rbAFrame.origin);
    rbA.getCenterOfMassTransform(tmpTrans).transform(pivotAInW);

    Vector3f pivotBInW = Stack.alloc(rbBFrame.origin);
View Full Code Here

    overlappingPairCache = sweepBP;

    constraintSolver = new SequentialImpulseConstraintSolver();
    dynamicsWorld = new DiscreteDynamicsWorld(dispatcher,overlappingPairCache,constraintSolver,collisionConfiguration);

    Transform startTransform = new Transform();
    startTransform.setIdentity();
    startTransform.origin.set(0.0f, 4.0f, 0.0f);

    ghostObject = new PairCachingGhostObject();
    ghostObject.setWorldTransform(startTransform);
    sweepBP.getOverlappingPairCache().setInternalGhostPairCallback(new GhostPairCallback());
View Full Code Here

      if (idle) {
        dt = 1.0f / 420.f;
      }

      // set walkDirection for our character
      Transform xform = ghostObject.getWorldTransform(new Transform());

      Vector3f forwardDir = new Vector3f();
      xform.basis.getRow(2, forwardDir);
      //printf("forwardDir=%f,%f,%f\n",forwardDir[0],forwardDir[1],forwardDir[2]);
      Vector3f upDir = new Vector3f();
View Full Code Here

    gl.glMatrixMode(gl.GL_PROJECTION);
    gl.glLoadIdentity();

    // look at the vehicle
    Transform characterWorldTrans = ghostObject.getWorldTransform(new Transform());
    Vector3f up = new Vector3f();
    characterWorldTrans.basis.getRow(1, up);
    Vector3f backward = new Vector3f();
    characterWorldTrans.basis.getRow(2, backward);
    backward.scale(-1);
View Full Code Here

  }
 
  public void updateWheelTransformsWS(WheelInfo wheel, boolean interpolatedTransform) {
    wheel.raycastInfo.isInContact = false;

    Transform chassisTrans = getChassisWorldTransform(Stack.alloc(Transform.class));
    if (interpolatedTransform && (getRigidBody().getMotionState() != null)) {
      getRigidBody().getMotionState().getWorldTransform(chassisTrans);
    }

    wheel.raycastInfo.hardPointWS.set(wheel.chassisConnectionPointCS);
    chassisTrans.transform(wheel.raycastInfo.hardPointWS);

    wheel.raycastInfo.wheelDirectionWS.set(wheel.wheelDirectionCS);
    chassisTrans.basis.transform(wheel.raycastInfo.wheelDirectionWS);

    wheel.raycastInfo.wheelAxleWS.set(wheel.wheelAxleCS);
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.