Package javax.vecmath

Examples of javax.vecmath.Vector3f.normalize()


    Vector3f up = Stack.alloc(Vector3f.class);
    up.negate(wheel.raycastInfo.wheelDirectionWS);
    Vector3f right = wheel.raycastInfo.wheelAxleWS;
    Vector3f fwd = Stack.alloc(Vector3f.class);
    fwd.cross(up, right);
    fwd.normalize();
    // up = right.cross(fwd);
    // up.normalize();

    // rotate around steering over de wheelAxleWS
    float steering = wheel.steering;
View Full Code Here


  protected void updateTargetPositionBasedOnCollision(Vector3f hitNormal, float tangentMag, float normalMag) {
    Vector3f movementDirection = Stack.alloc(Vector3f.class);
    movementDirection.sub(targetPosition, currentPosition);
    float movementLength = movementDirection.length();
    if (movementLength>BulletGlobals.SIMD_EPSILON) {
      movementDirection.normalize();

      Vector3f reflectDir = computeReflectionDirection(movementDirection, hitNormal, Stack.alloc(Vector3f.class));
      reflectDir.normalize();

      Vector3f parallelDir = parallelComponent(reflectDir, hitNormal, Stack.alloc(Vector3f.class));
View Full Code Here

    float movementLength = movementDirection.length();
    if (movementLength>BulletGlobals.SIMD_EPSILON) {
      movementDirection.normalize();

      Vector3f reflectDir = computeReflectionDirection(movementDirection, hitNormal, Stack.alloc(Vector3f.class));
      reflectDir.normalize();

      Vector3f parallelDir = parallelComponent(reflectDir, hitNormal, Stack.alloc(Vector3f.class));
      Vector3f perpindicularDir = perpindicularComponent(reflectDir, hitNormal, Stack.alloc(Vector3f.class));

      targetPosition.set(currentPosition);
View Full Code Here

        Vector3f currentDir = Stack.alloc(Vector3f.class);
        currentDir.sub(targetPosition, currentPosition);
        distance2 = currentDir.lengthSquared();
        if (distance2 > BulletGlobals.SIMD_EPSILON) {
          currentDir.normalize();
          // see Quake2: "If velocity is against original velocity, stop ead to avoid tiny oscilations in sloping corners."
          if (currentDir.dot(normalizedDirection) <= 0.0f) {
            break;
          }
        }
View Full Code Here

      xform.basis.getRow(1, upDir);
      Vector3f strafeDir = new Vector3f();
      xform.basis.getRow(0, strafeDir);
      forwardDir.normalize();
      upDir.normalize();
      strafeDir.normalize();

      Vector3f walkDirection = new Vector3f(0.0f, 0.0f, 0.0f);
      float walkVelocity = 1.1f * 4.0f; // 4 km/h -> 1.1 m/s
      float walkSpeed = walkVelocity * dt * characterScale;

 
View Full Code Here

    characterWorldTrans.basis.getRow(1, up);
    Vector3f backward = new Vector3f();
    characterWorldTrans.basis.getRow(2, backward);
    backward.scale(-1);
    up.normalize ();
    backward.normalize ();

    cameraTargetPosition.set(characterWorldTrans.origin);

    Vector3f cameraPosition = new Vector3f();
    cameraPosition.scale(2, up);
View Full Code Here

        // solve orthogonal angular velocity correction
        float relaxation = 1f;
        float len = velrelOrthog.length();
        if (len > 0.00001f) {
          Vector3f normal = Stack.alloc(Vector3f.class);
          normal.normalize(velrelOrthog);

          float denom = getRigidBodyA().computeAngularImpulseDenominator(normal) +
              getRigidBodyB().computeAngularImpulseDenominator(normal);
          // scale for mass and relaxation
          // todo:  expose this 0.9 factor to developer
View Full Code Here

        angularError.negate();
        angularError.scale(1f / timeStep);
        float len2 = angularError.length();
        if (len2 > 0.00001f) {
          Vector3f normal2 = Stack.alloc(Vector3f.class);
          normal2.normalize(angularError);

          float denom2 = getRigidBodyA().computeAngularImpulseDenominator(normal2) +
              getRigidBodyB().computeAngularImpulseDenominator(normal2);
          angularError.scale((1f / denom2) * relaxation);
        }
 
View Full Code Here

      float speed = linearVelocity.length();
      if (speed < linearDamping) {
        float dampVel = 0.005f;
        if (speed > dampVel) {
          Vector3f dir = Stack.alloc(linearVelocity);
          dir.normalize();
          dir.scale(dampVel);
          linearVelocity.sub(dir);
        }
        else {
          linearVelocity.set(0f, 0f, 0f);
View Full Code Here

      float angSpeed = angularVelocity.length();
      if (angSpeed < angularDamping) {
        float angDampVel = 0.005f;
        if (angSpeed > angDampVel) {
          Vector3f dir = Stack.alloc(angularVelocity);
          dir.normalize();
          dir.scale(angDampVel);
          angularVelocity.sub(dir);
        }
        else {
          angularVelocity.set(0f, 0f, 0f);
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.