/// <summary> /// Initialize this device. /// </summary> public virtual void InitDevice(VRContext context) { // Replace the center eye if needed. if (isCenterEye) { Transform t = transform; Transform trackingSpace = context.GetAnchor(VRNode.TrackingSpace, null); Transform centerEye = context.GetAnchor(VRNode.CenterEye, null); if (trackingSpace != null) { t.SetParent(trackingSpace); t.localPosition = Vector3.zero; t.localRotation = Quaternion.identity; t.localScale = Vector3.one; } if (centerEye != null) { // TODO : You may have a lot of work to do. foreach (Transform c in centerEye) { c.SetParent(t, false); } centerEye.gameObject.SetActive(false); // Log.d("VRDevice", "Replace origin center eye."); } context.SetAnchor(VRNode.CenterEye, t, true); } // m_MethodIsPresent = ReflectUtil.ParseDelegate <System.Func <bool> >(methodIsPresent); m_MethodRefreshRate = ReflectUtil.ParseDelegate <System.Func <float> >(methodRefreshRate); if (m_MethodRefreshRate == null) { float f; if (float.TryParse(methodRefreshRate, out f)) { m_MethodRefreshRate = () => (f); } } if (useUnityVR) // TODO : more method? { Log.i("VRDevice", "UnityVR loads a device(model = \"" + UnityEngine.VR.VRDevice.model + "\")."); switch (UnityEngine.VR.VRDevice.model) { case "Oculus Rift DK2": m_MethodRefreshRate = () => (75.0f); break; case "": //dummy, nothing is plugged in or no vr device m_MethodRefreshRate = () => (60.0f); break; #if !UNITY_EDITOR && UNITY_ANDROID default: // Cardboard,Gear VR and Daydream. m_MethodRefreshRate = () => (60.0f); break; #endif } } }
public override void InitDevice(VRContext context) { useUnityVR = true; UnityEngine.XR.InputTracking.Recenter(); trackingOriginType = TrackingOrigin.EyeLevel; SetTrackingOriginType(ovrTrackingOrigin.EyeLevel); // neckToEye.Set(0.0f, 0.075f, eyeDepth); position = false; // base.InitDevice(context); }
/// <summary> /// /// </summary> protected virtual void Awake() { if (s_Main == null) { s_Main = this; } else if (s_Main != this) { Ximmerse.Log.e("VRContext", "Only one instance can be run!!!"); } InitVRContext(); }
/// <summary> /// /// </summary> protected virtual void Awake() { //if(VRContextManager.instance!=null) { // return; //} // if (s_Main == null) { s_Main = this; } else if (s_Main != this) { Ximmerse.Log.e("VRContext", "Only one instance can be run!!!"); } InitVRContext(); }
public virtual void OnVRContextInited(VRContext context) { m_CenterEyeAnchor = context.GetAnchor(VRNode.CenterEye, null); m_HeadPosition = Vector3.zero; yawOffset = 0.0f; // if (m_CenterEyeAnchor != null) { m_EyeMover = new GameObject("EyeMover").transform; m_EyeMover.SetParent(m_CenterEyeAnchor.parent); m_EyeMover.localPosition = Vector3.zero; m_EyeMover.localRotation = Quaternion.identity; m_EyeMover.localScale = Vector3.one; m_CenterEyeAnchor.SetParent(m_EyeMover); m_CenterEyeAnchor.localPosition = Vector3.zero; m_CenterEyeAnchor.localRotation = Quaternion.identity; m_CenterEyeAnchor.localScale = Vector3.one; } }
public override void InitDevice(VRContext context) { useUnityVR = true; UnityEngine.XR.InputTracking.Recenter(); #if UNITY_5_6_OR_NEWER UnityEngine.XR.InputTracking.disablePositionalTracking = true; #else #endif trackingOriginType = TrackingOrigin.EyeLevel; // #if OPENVR_SDK ETrackedPropertyError e = ETrackedPropertyError.TrackedProp_Success; for (int i = (int)EIndex.Device1, iend = (int)EIndex.Device15; i <= iend; ++i) { if (OpenVR.System.GetInt32TrackedDeviceProperty((uint)i, ETrackedDeviceProperty.Prop_DeviceClass_Int32, ref e) == (int)ETrackedDeviceClass.GenericTracker) { index = (EIndex)i; break; } } #endif // base.InitDevice(context); }
/// <summary> /// Initialize this device. /// </summary> public virtual void InitDevice(VRContext context) { m_Handle = XDevicePlugin.GetInputDeviceHandle("VRDevice"); }
public virtual void OnVRContextInited(VRContext context) { m_CenterEyeAnchor = context.GetAnchor(VRNode.CenterEye, null); }
public override void OnVRContextInited(VRContext context) { base.OnVRContextInited(context); }