public bool IsHeadTracked() { if (!mHasHmd) { return(true); } #if UNITY_PS4 && !UNITY_EDITOR int handle = PlayStationVR.GetHmdHandle(); PlayStationVRTrackingStatus status; Tracker.GetTrackedDeviceStatus(handle, out status); if (status != PlayStationVRTrackingStatus.Tracking) { return(false); } PlayStationVRTrackingQuality quality; Tracker.GetTrackedDevicePositionQuality(handle, out quality); return(quality == PlayStationVRTrackingQuality.Full); #elif VZ_GAME && !UNITY_ANDROID if (IsSteamVR) { return(!SteamVR.outOfRange); } else { return(OVRPlugin.positionTracked); } #else return(true); #endif }
/** * @brief PSVR HMDの位置 */ private void UpdateHmdPosition() { if (VRSettings.enabled) { int hmdHandle = PlayStationVR.GetHmdHandle(); Tracker.GetTrackedDevicePosition(hmdHandle, PlayStationVRSpace.Raw, out outhmdPositionRaw); Tracker.GetTrackedDevicePosition(hmdHandle, PlayStationVRSpace.Unity, out outhmdPositionUnity); Tracker.GetTrackedDeviceOrientation(hmdHandle, PlayStationVRSpace.Unity, out outhmdOrientation); } else { Camera camera = transform.GetChild(0).gameObject.GetComponent <Camera>(); outhmdOrientation = camera.transform.rotation; } }