private void HandleSelectionComplete()
 {
     if (m_GazeOver)
     {
         if (m_MenuSM.State == MenuState.Exit)
         {
             if (HI5_Manager.GetGloveStatus() == null)
             {
                 m_MenuSM.State = MenuState.Main;
             }
             else
             {
                 /*if (HI5_Manager.GetGloveStatus().IsLeftGloveAvailable)
                  *  Debug.Log("IsLeftGloveAvailable");
                  * if (HI5_Manager.GetGloveStatus().IsRightGloveAvailable)
                  *  Debug.Log("IsRightGloveAvailable");
                  * if (HI5_BindInfoManager.IsRightGloveBinded)
                  *  Debug.Log("IsRightGloveBinded");
                  * if (HI5_BindInfoManager.IsLeftGloveBinded)
                  *  Debug.Log("IsLeftGloveBinded");*/
                 if (HI5_Manager.GetGloveStatus().IsLeftGloveAvailable &&
                     HI5_Manager.GetGloveStatus().IsRightGloveAvailable &&
                     HI5_BindInfoManager.IsLeftGloveBinded && HI5_BindInfoManager.IsRightGloveBinded)
                 {
                     m_MenuSM.State = MenuState.Main;
                 }
             }
         }
         else
         {
             m_MenuSM.State = MenuState.Exit;
         }
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (!HI5_Manager.GetGloveStatus().IsGloveAvailable(HI5.Hand.LEFT) &&
            !HI5_Manager.GetGloveStatus().IsGloveAvailable(HI5.Hand.RIGHT))
        {
            return;
        }

        if (fingers.Count == 0)
        {
            hasRelease = false;
        }

        if (previousFingerCount != fingers.Count && previousFingerCount > 0 && fingers.Count == 0)
        {
            hasRelease = true;
        }

        hasGrab = false;

        if (previousFingerCount != fingers.Count && previousFingerCount == 0 && fingers.Count > 2)
        {
            hasGrab = true;
        }

        previousFingerCount = fingers.Count;

        forward = (palmForward.position - palmCenter.position).normalized;

        //line.SetPosition(0, palmCenter.position);
        //line.SetPosition(1, palmCenter.position + forward * 10);
    }
Пример #3
0
        private void CheckIsValid()
        {
            bool isAvailable = false;

            if (m_Status != null)
            {
                isAvailable = m_Status.IsGloveAvailable(HandType);
            }
            bool isBinded      = HI5_BindInfoManager.IsGloveBinded(HandType);
            bool isBposSuccess = HI5_Manager.GetGloveStatus().isGloveBPosSuccess();

            if (isAvailable && isBinded && isBposSuccess)
            {
                if (HI5_Calibration.IsCalibratingBPose)
                {
                    isValid = false;
                }
                else
                {
                    isValid = true;
                }
            }
            else
            {
                isValid = false;
            }

            //if (HI5_Calibration.IsCalibratingBPose)
            //    isValid = false;
        }
 private void Disconnect()
 {
     if (HI5_Manager.IsConnected)
     {
         HI5_Manager.DisConnect();
     }
 }
 private void HandleTriggerEnter()
 {
     if (m_MenuSM == null)
     {
         return;
     }
     if (m_MenuSM.State == MenuState.Exit)
     {
         if (HI5_Manager.GetGloveStatus() == null)
         {
             m_MenuSM.State = MenuState.Main;
         }
         else
         {
             if (HI5_Manager.GetGloveStatus().IsLeftGloveAvailable &&
                 HI5_Manager.GetGloveStatus().IsRightGloveAvailable &&
                 HI5_BindInfoManager.IsLeftGloveBinded && HI5_BindInfoManager.IsRightGloveBinded)
             {
                 m_MenuSM.State = MenuState.Main;
             }
         }
     }
     else
     {
         m_MenuSM.State = MenuState.Exit;
     }
 }
        new void Update()
        {
            base.Update();
            //ruige 2018 3 27
            if (m_Status != null)
            {
                if (HI5_Manager.modifyThreadSave)
                {
                    m_Status.MainThreadUpdate();
                    HI5_Manager.Update();
                }
            }
            CheckIsValid();
            UpdateModelRenderer(isValid);

            if (!isValid)
            {
                return;
            }
            //if (m_Status.Status == GloveStatus.NoDongle)
            //    return;
            if (m_BindSource != null)
            {
                ApplyHandMotion_Rotation(m_BindSource);
            }

            if (m_BindSource != null)
            {
                ApplyFingerMotion(m_BindSource);
            }
        }
 private void Connect()
 {
     if (!HI5_Manager.IsConnected)
     {
         HI5_Manager.Connect();
     }
 }
        //キャリブレーション前の処理
        private void AwakeCalibration()
        {
            if (!HI5_Manager.IsConnected || HI5_Manager.GetGloveStatus().Status != GloveStatus.BothGloveAvailable)
            {
                SetDebugMessage("Error! Please Connect Noitom Hi5!");
                return;
            }

            //既存のOpticalDataを読み込む
            if (_isPushExistingOpticalData)
            {
                ResetOpticalDataList(ref _leftPos, ref _rightPos, ref _leftRot, ref _rightRot);

                var leftOd  = GetExistingOpticalData("LEFT.csv", ref _leftPos, ref _leftRot);
                var rightOd = GetExistingOpticalData("RIGHT.csv", ref _rightPos, ref _rightRot);

                //ファイル読み込みに失敗したら弾く
                if (!leftOd || !rightOd)
                {
                    SetDebugMessage("Error! Please Set OpticalData!");
                    return;
                }
            }

            //BPoseキャリブレーションを開始
            State = HI5_Pose.BPose;
        }
Пример #9
0
 protected void Connect()
 {
     if (!HI5_Manager.IsConnected)
     {
         HI5_Manager.Connect();
     }
     m_BindSource = HI5_Manager.GetHI5Source();
 }
Пример #10
0
        private void Connect()
        {
            if (!HI5_Manager.IsConnected)
            {
                HI5_Manager.Connect();
            }

            _hi5Source = HI5_Manager.GetHI5Source();
        }
Пример #11
0
 protected void Disconnect()
 {
     if (HI5_Manager.IsConnected)
     {
         HI5_Manager.DisConnect();
     }
     else
     {
         return;
     }
 }
Пример #12
0
    private void FixedUpdate()
    {
        if (!HI5_Manager.GetGloveStatus().IsGloveAvailable(HI5.Hand.LEFT) &&
            !HI5_Manager.GetGloveStatus().IsGloveAvailable(HI5.Hand.RIGHT))
        {
            return;
        }

        velocity    = (transform.parent.localPosition - previousPos) / Time.fixedDeltaTime;
        previousPos = transform.parent.localPosition;
    }
Пример #13
0
        private void HandleCountDownComplete()
        {
            if (m_Pose == HI5_Pose.BPose)
            {
                HI5_Calibration.ResetCalibration();
                HI5_Manager.GetGloveStatus().StartCalibrationBpos();

                //删除文件
                // System.IO.File.Delete(HI5_Calibration.DefaultPathAndName);
            }
            HI5_Calibration.StartCalibration(m_Pose);
            StartCoroutine(UpdateCalibrationProgress());
        }
Пример #14
0
 public void StartCalibration(HI5_Pose posType)
 {
     mPercent = 0.0f;
     if (posType == HI5_Pose.BPose)
     {
         HI5_Manager.GetGloveStatus().BposErr = BPoseCalibrationErrors.BE_NotCalibrated;
         HI5_Calibration.ResetCalibration();
         HI5_Manager.GetGloveStatus().StartCalibrationBpos();
     }
     HI5_Calibration.StartCalibration(posType);
     mPos = posType;
     StartCoroutine(UpdateCalibrationProgress());
 }
Пример #15
0
        /**
         * Get hand event.
         * */
        void MessageFun(string messageKey, object param1, object param2)
        {
            if (messageKey.CompareTo(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKey.messageHandEvent) == 0)
            {
                Hi5_Glove_Interaction_Hand_Event_Data data = param1 as Hi5_Glove_Interaction_Hand_Event_Data;
                bool isRun = false;
                if (data.mHandType == EHandType.EHandLeft && mHand.m_IsLeftHand)
                {
                    isRun = true;
                }
                else if (data.mHandType == EHandType.EHandRight && !mHand.m_IsLeftHand)
                {
                    isRun = true;
                }
                if (!isRun)
                {
                    return;
                }
                switch (data.mEventType)
                {
                case EEventHandType.EClap:
                    if (data.mHandType == EHandType.EHandLeft && mHand.m_IsLeftHand)
                    {
                        HI5_Manager.EnableLeftVibration(200);
                    }
                    else if (data.mHandType == EHandType.EHandRight && !mHand.m_IsLeftHand)
                    {
                        HI5_Manager.EnableRightVibration(200);
                    }
                    break;

                case EEventHandType.EPoke:
                    break;

                case EEventHandType.EPinch:

                    break;

                case EEventHandType.EThrow:
                    break;

                case EEventHandType.ELift:
                    break;

                case EEventHandType.ERelease:
                    break;
                }
            }
        }
        private bool IsEnvironmentGood()
        {
            HI5_GloveStatus gloveStatus = HI5_Manager.GetGloveStatus();

            if (gloveStatus.LeftMagneticStatus != MagneticStatus.Good ||
                gloveStatus.RightMagneticStatus != MagneticStatus.Good ||
                gloveStatus.LeftPower == PowerLevel.Low ||
                gloveStatus.RightPower == PowerLevel.Low)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #17
0
    private void Vibrate()
    {
        if (grab == null)
        {
            return;
        }

        int time = 80;

        if (grab.gameObject.layer == 9)
        {
            HI5_Manager.EnableRightVibration(time);
        }
        if (grab.gameObject.layer == 10)
        {
            HI5_Manager.EnableLeftVibration(time);
        }
    }
Пример #18
0
        private void Update()
        {
            if (_hi5Source == null || !HI5_Manager.IsConnected)
            {
                return;
            }

            if ((handType == HandType.Left || handType == HandType.Both) &&
                HI5_Manager.GetGloveStatus().IsLeftGloveAvailable)
            {
                ApplyHandMotion_Rotation(Hand.LEFT, _hi5Source, ref _leftHi5EulerAngles);
                ApplyFingerMotion(Hand.LEFT, _hi5Source, ref _leftHi5EulerAngles);
            }

            if ((handType == HandType.Right || handType == HandType.Both) &&
                HI5_Manager.GetGloveStatus().IsRightGloveAvailable)
            {
                ApplyHandMotion_Rotation(Hand.RIGHT, _hi5Source, ref _rightHi5EulerAngles);
                ApplyFingerMotion(Hand.RIGHT, _hi5Source, ref _rightHi5EulerAngles);
            }
        }
Пример #19
0
        IEnumerator UpdateCalibrationProgress()
        {
            int calibrationProgress = 0;

            while (calibrationProgress < 100)
            {
                calibrationProgress = HI5_Calibration.GetCalibrationProgress(mPos);
                mPercent            = (float)calibrationProgress;
                yield return(null);
            }
            if (mPos == HI5_Pose.BPose)
            {
                if (HI5_Manager.GetGloveStatus().BposReceiveResult)
                {
                    if (HI5_Manager.GetGloveStatus().IsCalibrationBposSuccess)
                    {
                        CalibrationInterfaceResult result = new CalibrationInterfaceResult();
                        result.result = ECalibrationInterfaceResult.EBposSuccess;
                        Hi5_Message.GetInstance().DispenseMessage(Hi5_Message.Hi5_MessageMessageKey.messageCalibrationResult, (object)result);
                    }
                    else
                    {
                        CalibrationInterfaceResult result = new CalibrationInterfaceResult();
                        result.result = ECalibrationInterfaceResult.EBposFailed;
                        Hi5_Message.GetInstance().DispenseMessage(Hi5_Message.Hi5_MessageMessageKey.messageCalibrationResult, (object)result);
                    }
                }
                else
                {
                    yield return(null);
                }
            }
            else
            {
                CalibrationInterfaceResult result = new CalibrationInterfaceResult();
                result.result = ECalibrationInterfaceResult.EPposComplete;
                Hi5_Message.GetInstance().DispenseMessage(Hi5_Message.Hi5_MessageMessageKey.messageCalibrationResult, (object)result);
            }
        }
        private void OnNewPoses(TrackedDevicePose_t[] poses)
        {
            int index = HandType == Hand.LEFT ? HI5_BindInfoManager.LeftID : HI5_BindInfoManager.RightID;

            if (index == -1)
            {
                return;
            }

            if (poses.Length <= index)
            {
                return;
            }

            if (!poses[index].bDeviceIsConnected)
            {
                return;
            }

            if (!poses[index].bPoseIsValid)
            {
                return;
            }

            var pose = new SteamVR_Utils.RigidTransform(poses[index].mDeviceToAbsoluteTracking);

            Vector3    pos = pose.pos;
            Quaternion rot = pose.rot;

            if (m_Status.Status != GloveStatus.NoGlove &&
                m_Status.Status != GloveStatus.NoDongle &&
                HI5_Manager.IsDongleAvailable() &&
                HI5_Manager.IsHasDongle)
            {
                ApplyHandMotion_Position(pos, rot);
            }
        }
        //カウントダウン終了時の処理
        private void HandleCountDownComplete()
        {
            if (State == HI5_Pose.Unknown)
            {
                calibrationScreen[2].SetActive(false);
                StartCoroutine(CalibrationKeyDownCheckCoroutine());
                return;
            }

            //SetDebugMessage("Calibration Start!");

            if (State == HI5_Pose.BPose)
            {
                //既存のキャリブレーションデータを削除
                HI5_Calibration.ResetCalibration();
                //BPoseキャリブレーションを開始するという通知
                HI5_Manager.GetGloveStatus().StartCalibrationBpos();
            }

            //キャリブレーションを開始
            HI5_Calibration.StartCalibration(State);
            //進行状態を取得するコルーチン
            StartCoroutine(CalibrationProgressCheckCoroutine(State));
        }
Пример #22
0
 private void Start()
 {
     m_Status = HI5_Manager.GetGloveStatus();
 }
Пример #23
0
 private void OnEnable()
 {
     m_HI5Status = HI5_Manager.GetGloveStatus();
 }
Пример #24
0
 // Used by HI5_InstanceEditor.
 public void AutoBindBones(Hand type)
 {
     HI5_Manager.BindBones(m_Root, HandBones, m_Prefix, type);
 }