Package com.mtbs3d.minecrift.settings

Examples of com.mtbs3d.minecrift.settings.VRSettings


        {
          headPos = Vec3.createVectorHelper(0, 0, 0);
            return;
        }

        VRSettings vrSettings = Minecraft.getMinecraft().vrSettings;
       
        if( resetOriginRotation )
        {
          //TODO: this might be backwards: with only a razer to test the yawHeadDegrees, its always the same!
          if( Minecraft.getMinecraft().headTracker != this ) //if the positional tracker is the hydra, they are always aligned
          {
            baseStationYawOffset = cont1Yaw - yawHeadDegrees; //assume hydra oriented straight with head orientation
            if( vrSettings.posTrackHydraLoc == vrSettings.POS_TRACK_HYDRA_LOC_BACK_OF_HEAD)   // TODO: Also needed for HMD top?
                {
                    //assume hydra oriented at 90degrees to head orientation
              if (vrSettings.posTrackHydraBIsPointingLeft)
                    {
                        baseStationYawOffset -= 90;
                    }
                    else
                    {
                        baseStationYawOffset += 90;
                    }
                }
          }
          resetOriginRotation = false;
        }
       

        // Using a single controller. Select controller. poll() has already switch left and right depending on configuration
        //cont1 is for head tracking, if head tracking is enabled (TODO: make head tracking optional?)
        float rawX = cont1PosX;
        float rawY = cont1PosY;
        float rawZ = cont1PosZ;

        if (vrSettings.posTrackHydraLoc == vrSettings.POS_TRACK_HYDRA_LOC_HMD_LEFT_AND_RIGHT)
        {
          //Otherwise, use average of controllers
            rawX = (cont1PosX + cont2PosX) / 2.0f;
            rawY = (cont1PosY + cont2PosY) / 2.0f;
            rawZ = (cont1PosZ + cont2PosZ) / 2.0f;
        }

        // Correct for distance from base y axis skew
        // 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);
 
View Full Code Here

TOP

Related Classes of com.mtbs3d.minecrift.settings.VRSettings

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.