コード例 #1
0
    void Update()
    {
        //Debug.Log(NuitrackManager.СurrentHands);

        if (Application.platform != RuntimePlatform.WindowsEditor)
        {
            if (NuitrackManager.СurrentHands != null)
            {
                if (rightHand)
                {
                    if (NuitrackManager.СurrentHands.RightHand != null)
                    {
                        hand = (nuitrack.HandContent)NuitrackManager.СurrentHands.RightHand;

                        pressure = Mathf.Lerp(pressure, hand.Pressure / 100.0f, pressSpeed * Time.deltaTime);
                    }
                }
                else
                {
                    if (NuitrackManager.СurrentHands.LeftHand != null)
                    {
                        hand     = (nuitrack.HandContent)NuitrackManager.СurrentHands.LeftHand;
                        pressure = Mathf.Lerp(pressure, hand.Pressure / 100.0f, pressSpeed * Time.deltaTime);
                    }
                }
            }
        }

        //pressure = Mathf.InverseLerp(minPressure, maxPressure, pressure);

        if (pressure > maxPressure)
        {
            maxPressure = pressure;
        }
        if (pressure < minPressure)
        {
            minPressure = pressure;
        }

        for (int i = 0; i < bones.Length; i++)
        {
            bones[i].bone.localEulerAngles = Vector3.Lerp(bones[i].minAngle, bones[i].maxAngle, Mathf.InverseLerp(minPressure, maxPressure, pressure));
        }
    }
コード例 #2
0
 public Hand(nuitrack.HandContent handContent)
 {
     RawHandContent = handContent;
 }