示例#1
0
 public static Quaternion FromFlippedZQuatf(this OVRPlugin.Quatf q)
 {
     return(new Quaternion()
     {
         x = -q.x, y = -q.y, z = q.z, w = q.w
     });
 }
示例#2
0
 internal static Quaternion FromQuatf(this OVRPlugin.Quatf q)
 {
     return(new Quaternion()
     {
         x = q.x, y = q.y, z = q.z, w = q.w
     });
 }
    void Update()
    {
        try
        {
            if (m_Hand == null || !m_Hand.IsTracked || !m_Hand.IsDataHighConfidence)
            {
                ChangePinchStateToTrue(TherapyData.PinchType.None);
                return;
            }

            OVRPlugin.GetHandState(OVRPlugin.Step.Physics, whichHand, ref state);
            //LateralTestsAndPinchDebuging();

            if (m_Hand.GetFingerIsPinching(OVRHand.HandFinger.Index))
            {
                OVRPlugin.Quatf index = state.BoneRotations[(int)OVRSkeleton.BoneId.Hand_Index3];
                OVRPlugin.Quatf thumb = state.BoneRotations[(int)OVRSkeleton.BoneId.Hand_Thumb3];
                float           angle = Vector3.Angle(new Vector3(index.x, index.y, index.z), new Vector3(thumb.x, thumb.y, thumb.z));

                if (angle < 70)                                                // Tip Pinch
                {
                    if (m_Hand.GetFingerIsPinching(OVRHand.HandFinger.Middle)) // 3 finger are pinching
                    {
                        ChangePinchStateToTrue(TherapyData.PinchType.Tip3);
                    }
                    else
                    {
                        ChangePinchStateToTrue(TherapyData.PinchType.Tip2);
                    }
                }
                else if (angle > 70)                                           // Pad Pinch
                {
                    if (m_Hand.GetFingerIsPinching(OVRHand.HandFinger.Middle)) // 3 finger are pinching
                    {
                        ChangePinchStateToTrue(TherapyData.PinchType.Pad3);
                    }
                    else
                    {
                        ChangePinchStateToTrue(TherapyData.PinchType.Pad2);
                    }
                }
            }
            else// Not pinching at all
            {
                ChangePinchStateToTrue(TherapyData.PinchType.None);
            }
        }
        catch (Exception e)
        {
            MainController.PrintToLog(e.ToString(), MainController.LogType.Error);
            //m_debugText.text = e.ToString();
        }
    }
示例#4
0
	internal static Quaternion FromFlippedZQuatf(this OVRPlugin.Quatf q)
	{
		return new Quaternion() { x = -q.x, y = -q.y, z = q.z, w = q.w }:
	}