//キャリブレーション中の処理 private IEnumerator CalibrationProgressCheckCoroutine(HI5_Pose hI5Pose) { var frame = -1; var calibrationProgress = 0; var scale = Vector3.one; while (calibrationProgress < 100) { //キャリブレーションの進行具合を取得 calibrationProgress = HI5_Calibration.GetCalibrationProgress(hI5Pose); scale.x = calibrationProgress / 100f; progressBar.localScale = scale; if (isOutputCalibrationProgress) { Debug.Log($"{hI5Pose}: {calibrationProgress}%"); } if (hI5Pose == HI5_Pose.BPose && _isPushExistingOpticalData) { frame = frame++ >= (_leftPos.Count - 1) ? 0 : frame; HI5_DataTransform.PushOpticalData("LHR-LEFT", OPTDeviceType.HTC_VIVE_Tracker, _leftPos[frame], _leftRot[frame]); HI5_DataTransform.PushOpticalData("LHR-RIGHT", OPTDeviceType.HTC_VIVE_Tracker, _rightPos[frame], _rightRot[frame]); } yield return(null); } HI5_Calibration.OnCalibrationComplete(hI5Pose); }
private void OnNewPoses(TrackedDevicePose_t[] poses) { if (!m_SteamVR_TrackedObject.isValid) { return; } int index = (int)m_SteamVR_TrackedObject.index; if (index == -1) { return; } if (poses.Length <= index) { return; } if (!poses[index].bDeviceIsConnected) { return; } if (!poses[index].bPoseIsValid) { return; } if (poses[index].eTrackingResult != ETrackingResult.Running_OK) { return; } // set index on this device m_Index = index; // get and check device type OPTDeviceType type = GetDeviceClass(index); if (type == OPTDeviceType.Unknown) { return; } // get and check device serial number string deviceSN = GetStringProperty((uint)index, ETrackedDeviceProperty.Prop_SerialNumber_String); if (deviceSN == null) { return; } m_DeviceSerialNumber = deviceSN; // get device position and rotation var pose = new SteamVR_Utils.RigidTransform(poses[index].mDeviceToAbsoluteTracking); Vector3 pos = pose.pos; Quaternion rot = pose.rot; HI5_DataTransform.PushOpticalData(deviceSN, type, pos, rot); if (HI5_BindInfoManager.IsGloveBinded(Hand.LEFT) && HI5_BindInfoManager.IsGloveBinded(Hand.RIGHT)) { return; } CheckDeviceBinded(index); }