private void OnEnable() { if (IsInstance) { m_viveRole.onDeviceIndexChanged += OnDeviceIndexChanged; VivePose.AddNewPosesListener(this); OnDeviceIndexChanged(m_viveRole.GetDeviceIndex()); } }
private void InternalSetQuadViewActive(bool value) { if (value && m_externalCamera == null && !string.IsNullOrEmpty(m_configPath) && File.Exists(m_configPath)) { // don't know why SteamVR_ExternalCamera must be instantiated from the prefab // when create SteamVR_ExternalCamera using AddComponent, errors came out when disabling var prefab = Resources.Load <GameObject>("SteamVR_ExternalCamera"); if (prefab == null) { Debug.LogError("SteamVR_ExternalCamera prefab not found!"); } else { var ctrlMgr = Instantiate(prefab); var extCam = ctrlMgr.transform.GetChild(0); extCam.gameObject.name = "SteamVR External Camera"; extCam.SetParent(transform, false); DestroyImmediate(extCam.GetComponent <SteamVR_TrackedObject>()); DestroyImmediate(ctrlMgr); m_externalCamera = extCam.GetComponent <SteamVR_ExternalCamera>(); SteamVR_Render.instance.externalCamera = m_externalCamera; m_externalCamera.configPath = m_configPath; m_externalCamera.ReadConfig(); } } if (m_externalCamera != null) { m_externalCamera.gameObject.SetActive(value); if (value) { VivePose.AddNewPosesListener(this); } else { VivePose.RemoveNewPosesListener(this); } } }
private void UpdateExCamActivity() { if (!enabled) { SetValid(false); VivePose.RemoveNewPosesListener(this); } else if (VRModule.IsValidDeviceIndex(m_viveRole.GetDeviceIndex())) { SetValid(m_quadViewEnabled); VivePose.AddNewPosesListener(this); } else if (m_staticExCamEnabled) { SetValid(m_quadViewEnabled); VivePose.AddNewPosesListener(this); } else { SetValid(false); VivePose.RemoveNewPosesListener(this); } }
protected virtual void OnEnable() { VivePose.AddNewPosesListener(this); }
protected virtual void OnEnable() { VivePose.AddNewPosesListener(this); SetValid(m_isValid = VivePose.IsValidEx(viveRole.roleType, viveRole.roleValue)); }