private IEnumerator DoInitialize(SteamVR_RenderModel renderModel) { while (renderModel.initializedAttachPoints == false) { yield return(null); } textHintParent = new GameObject("Text Hints").transform; textHintParent.SetParent(this.transform); textHintParent.localPosition = Vector3.zero; textHintParent.localRotation = Quaternion.identity; textHintParent.localScale = Vector3.one; //Get the button mask for each component of the render model var renderModels = OpenVR.RenderModels; if (renderModels != null) { string renderModelDebug = "Components for render model " + renderModel.index; for (int childIndex = 0; childIndex < renderModel.transform.childCount; childIndex++) { Transform child = renderModel.transform.GetChild(childIndex); componentTransformMap.Add(child.name, child); renderModelDebug += "\n\t" + child.name + "."; } //Uncomment to show the button mask for each component of the render model HintDebugLog(renderModelDebug); } actionHintInfos = new Dictionary <SteamVR_Action_In, ActionHintInfo>(); for (int actionIndex = 0; actionIndex < SteamVR_Input.actionsNonPoseNonSkeletonIn.Length; actionIndex++) { SteamVR_Action_In action = (SteamVR_Action_In)SteamVR_Input.actionsNonPoseNonSkeletonIn[actionIndex]; if (action.GetActive(inputSource)) { CreateAndAddButtonInfo(action, inputSource); } } ComputeTextEndTransforms(); initialized = true; //Set the controller hints render model to not active renderModel.SetMeshRendererState(true); renderModel.gameObject.SetActive(false); }
protected bool CheckActive(SteamVR_Action_In action, SteamVR_Input_Sources source) { bool actionActive = action.GetActive(source) && action.actionSet.IsActive(); if (elementActive != actionActive || initialOpacitySet == false) { float opacity = actionActive ? actionCanvas.activeOpacity : actionCanvas.inactiveOpacity; SetOpacity(opacity); initialOpacitySet = true; elementActive = actionActive; } return(actionActive); }
//------------------------------------------------- private IEnumerator TestButtonHints() { while (true) { for (int actionIndex = 0; actionIndex < SteamVR_Input.actionsNonPoseNonSkeletonIn.Length; actionIndex++) { SteamVR_Action_In action = (SteamVR_Action_In)SteamVR_Input.actionsNonPoseNonSkeletonIn[actionIndex]; if (action.GetActive(inputSource)) { ShowButtonHint(action); yield return(new WaitForSeconds(1.0f)); } yield return(null); } } }
//------------------------------------------------- private IEnumerator TestTextHints() { while (true) { for (int actionIndex = 0; actionIndex < SteamVR_Input.actionsNonPoseNonSkeletonIn.Length; actionIndex++) { SteamVR_Action_In action = (SteamVR_Action_In)SteamVR_Input.actionsNonPoseNonSkeletonIn[actionIndex]; if (action.GetActive(inputSource)) { ShowText(action, action.GetShortName()); yield return(new WaitForSeconds(3.0f)); } yield return(null); } HideAllText(); yield return(new WaitForSeconds(3.0f)); } }
//------------------------------------------------- // Cycles through all the text hints on the controller //------------------------------------------------- private IEnumerator TestTextHints(Hand hand) { ControllerButtonHints.HideAllTextHints(hand); while (true) { for (int actionIndex = 0; actionIndex < SteamVR_Input.actionsIn.Length; actionIndex++) { SteamVR_Action_In action = (SteamVR_Action_In)SteamVR_Input.actionsIn[actionIndex]; if (action.GetActive(hand.handType)) { ControllerButtonHints.ShowTextHint(hand, action, action.GetShortName()); yield return(new WaitForSeconds(3.0f)); ControllerButtonHints.HideTextHint(hand, action); yield return(new WaitForSeconds(0.5f)); } yield return(null); } ControllerButtonHints.HideAllTextHints(hand); yield return(new WaitForSeconds(3.0f)); } }