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 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; }
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; } } }
// 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); }
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; } }
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; }
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()); }
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()); }
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); } }
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); } }
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 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)); }
private void Start() { m_Status = HI5_Manager.GetGloveStatus(); }
private void OnEnable() { m_HI5Status = HI5_Manager.GetGloveStatus(); }