示例#1
0
 public void Interpolate()
 {
     if (!hasBeenRipped)
     {
         if (!CheckIfSnapOverThreshold() && _customThrowable.getCurrentHandType() == SteamVR_Input_Sources.LeftHand)
         {
             head.transform.position =
                 Vector3.Lerp(leftHand.transform.position, bodySnapPoint.transform.position, 0.5f);
             //head.transform.rotation =
             //UnityEngine.Quaternion.Lerp(leftHand.transform.rotation, bodySnapPoint.transform.rotation, 0.5f);
             vibration.vibrationOfLeftController(0, 1, 1000, 200);
         }
         else if (!CheckIfSnapOverThreshold() &&
                  _customThrowable.getCurrentHandType() == SteamVR_Input_Sources.RightHand)
         {
             head.transform.position =
                 Vector3.Lerp(rightHand.transform.position, bodySnapPoint.transform.position, 0.5f);
             //head.transform.rotation =
             //UnityEngine.Quaternion.Lerp(leftHand.transform.rotation, bodySnapPoint.transform.rotation, 0.5f);
             vibration.vibrationOfRightController(0, 1, 1000, 200);
         }
         else if (CheckIfSnapOverThreshold())
         {
             ResetHeadToOriginalPosition();
         }
     }
 }
示例#2
0
文件: Rowing.cs 项目: iRandz/AAU-P6
    public void rowControl()
    {
        Vector3 differenceLeft  = leftHand.transform.position - previousPosLeft;
        Vector3 differenceRight = rightHand.transform.position - previousPosRight;

        if (firstActivate)
        {
            differenceLeft  = new Vector3(0, 0, 0);
            differenceRight = new Vector3(0, 0, 0);
            firstActivate   = false;
        }
        if (differenceLeft.x > 0 && differenceRight.x > 0 && !battle)
        {
            transform.position += new Vector3(((differenceLeft.x + differenceRight.x) / 2) * speedModifier, 0, 0);         //velocity * Time.deltaTime;
            vibration.vibrationOfRightController(0, 0.1f, 1000, 200);
            vibration.vibrationOfLeftController(0, 0.1f, 1000, 200);
            _audio.Play("RowSound");
        }
        previousPosLeft  = leftHand.transform.position;
        previousPosRight = rightHand.transform.position;
    }