Package net.minecraft.src

Examples of net.minecraft.src.Vec3


        // TODO: figure out why the heck this is required for Stella's Hydras...
        // TODO: rename this gameSetting to "hydraXRotationSkew" or other sensible name
        rawY += rawZ * MathHelper.sin(vrSettings.posTrackHydraYAxisDistanceSkewAngleDeg*PIOVER180 );
       
        //Raw is the absolute coordinate in hydra reference frame of the sample (possible average of two controllers)
        Vec3 raw = Vec3.createVectorHelper(rawX, rawY, rawZ);
       
        //Rel is the relative coordinate in hydra reference frame
        Vec3 rel = origin.subtract(raw);
       
        //Account for hydra base station / head tracker orientation not aligned
        //After this, rel is in body coordinates (relative to head tracker reference frame, not accounting for mouse-induced world yaw offset)
        rel.rotateAroundY(baseStationYawOffset*PIOVER180);

        //Now, compute the offset from the hydra controller to the camera location. Straight from the settings (although negated -
        //vrSettings stores eye center -> hydra values for user readability. We need hydra -> eye center values here)
        float hydraXOffset = -vrSettings.getPosTrackHydraOffsetX();
        float hydraYOffset = -vrSettings.getPosTrackHydraOffsetY();
        float hydraZOffset = vrSettings.getPosTrackHydraOffsetZ();

        // The configured offset is for a 0,0,0 rotation head. Apply current head orientation to get final offset
        Vec3 correctionToCentreEyePosition = Vec3.createVectorHelper(hydraXOffset, hydraYOffset, hydraZOffset);

        correctionToCentreEyePosition.rotateAroundZ(rollHeadDegrees*PIOVER180);
        correctionToCentreEyePosition.rotateAroundX(pitchHeadDegrees*PIOVER180);
        correctionToCentreEyePosition.rotateAroundY(-yawHeadDegrees*PIOVER180);

        //Add the hydra position (in head tracker reference frame) to the camera offset
        //to get the camera position in head tracker reference frame
        headPos = vecAdd(rel,correctionToCentreEyePosition);

        if (resetOrigin)
        {
          //We compute the "ideal" neck model position, in head tracker reference frame
          Vec3 neckModelToCentreEyePosition = Vec3.createVectorHelper(0, vrSettings.neckBaseToEyeHeight, -vrSettings.eyeProtrusion);
          neckModelToCentreEyePosition.rotateAroundZ(rollHeadDegrees*PIOVER180);
          neckModelToCentreEyePosition.rotateAroundX(pitchHeadDegrees*PIOVER180);
          neckModelToCentreEyePosition.rotateAroundY(-yawHeadDegrees*PIOVER180);

          //The actual hydra position on the head is offset from the eye center by this amount
          Vec3 originOffset = correctionToCentreEyePosition.subtract(neckModelToCentreEyePosition);
       
          //Counteract the base station yaw to get back to absolute razer coordinates
          originOffset.rotateAroundY(-baseStationYawOffset*PIOVER180);

            // save raw - originOffset as origin. That way, when origin is subtracted in the future,
          // positions very close to the current location+orientation will have the eye in the correct spot
          origin = originOffset.subtract(raw);
           
            resetOrigin = false;
        }

        // Rotate the centre eye position around any world yaw offset (mouse/controller induced rotation)
View Full Code Here


    public static Quaternion pow(Quaternion q1, float power)
    {
        Quaternion input = QuaternionHelper.clone(q1);
        float inputMagnitude = QuaternionHelper.magnitude(input);
        Vec3 nHat = Vec3.fakePool.getVecFromPool(input.x, input.y, input.z).normalize();
        Quaternion vectorBit = QuaternionHelper.exp(QuaternionHelper.scalarMultiply(new Quaternion((float)nHat.xCoord, (float)nHat.yCoord, (float)nHat.zCoord, 0), (float)(power * Math.acos(input.w / inputMagnitude))));
        return QuaternionHelper.scalarMultiply(vectorBit, (float)Math.pow(inputMagnitude, power));
    }
View Full Code Here

    }

    public static Quaternion exp(Quaternion input)
    {
        float inputA = input.w;
        Vec3 inputV = Vec3.fakePool.getVecFromPool(input.x, input.y, input.z);
        float outputA = (float)(Math.exp(inputA) * Math.cos(inputV.lengthVector()));
        Vec3 outputV = Vec3.fakePool.getVecFromPool(0, 0, 0);
        outputV.xCoord = Math.exp(inputA) * (inputV.normalize().xCoord * (float)Math.sin(inputV.lengthVector()));
        outputV.yCoord = Math.exp(inputA) * (inputV.normalize().yCoord * (float)Math.sin(inputV.lengthVector()));
        outputV.zCoord = Math.exp(inputA) * (inputV.normalize().zCoord * (float)Math.sin(inputV.lengthVector()));

        return new Quaternion((float)outputV.xCoord, (float)outputV.yCoord, (float)outputV.zCoord, outputA);
View Full Code Here

      }
      return new Coordinate(m.blockX, m.blockY, m.blockZ);
   }

   public MovingObjectPosition rayTrace(double distance, float partialTickTime) {
      Vec3 positionVec = getPositionVec(partialTickTime);
      Vec3 lookVec = player.getLook(partialTickTime);
      Vec3 hitVec = positionVec.addVector(lookVec.xCoord * distance, lookVec.yCoord * distance, lookVec.zCoord * distance);
      return player.worldObj.rayTraceBlocks_do_do(positionVec, hitVec, false, true); // TODO: Validate correct params
   }
View Full Code Here

TOP

Related Classes of net.minecraft.src.Vec3

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.