void FixedUpdate() { if (mIsDeviceAvailable) { mDevice.Update(); } UpdateHandPoses(); }
/// <summary> /// Initializes the controller variables. /// Intializes the UI Panels and creates them for every roboy part for every panel mode. /// </summary> void Start() { m_SteamVRController = GetComponentInParent <SteamVR_TrackedObject>(); // Find the controller and initialize the values to default m_SteamVRDevice = SteamVR_Controller.Input((int)m_SteamVRController.index); m_SteamVRDevice.Update(); m_SteamVRTrackedController = GetComponentInParent <SteamVR_TrackedController>(); // Find all template panels for fading List <Transform> allFadePanels = gameObject.GetComponentsInChildren <Transform>().Where(panel => panel.tag.Equals("FadePanelStruct")).ToList(); // Initialize the fade panels foreach (var fadePanel in allFadePanels) { Transform fadeInPanel = fadePanel.gameObject.GetComponentInChildWithTag <Transform>("FadeInPanel"); Transform fadeOutPanel = fadePanel.gameObject.GetComponentInChildWithTag <Transform>("FadeOutPanel"); Transform fadeStandardPanel = fadePanel.gameObject.GetComponentInChildWithTag <Transform>("FadeStandardPanel"); FadePanelStruct fadePanelStruct; fadePanelStruct.FadeInPanel = fadeInPanel; fadePanelStruct.FadeOutPanel = fadeOutPanel; fadePanelStruct.FadeStandardPanel = fadeStandardPanel; m_UIFadePanels.Add(fadeInPanel.parent.GetComponent <FadePanelTemplate>().Alignment, fadePanelStruct); fadePanel.gameObject.GetComponentInChildWithTag <Transform>("FadeInPanel").gameObject.SetActive(false); fadePanel.gameObject.GetComponentInChildWithTag <Transform>("FadeOutPanel").gameObject.SetActive(false); fadePanel.gameObject.GetComponentInChildWithTag <Transform>("FadeStandardPanel").gameObject.SetActive(false); } // get the selection panel m_SelectionPanel = GetComponentInChildren <SelectionPanel>(); // initialize the UI panels InitializePanels(); }