protected void InitializeFromActiveNavigation() { // Search for navigation interaction parameters uint interactionNb = MiddleVR.VRInteractionMgr.GetInteractionsNb(); if (interactionNb == 0) { MVRTools.Log(4, "[~] VRHeadCollision: no interaction found in Interaction Manager."); return; } bool fly = true; vrNode3D navNodeMVR = null; for (uint i = 0; i < interactionNb; ++i) { vrInteraction interaction = MiddleVR.VRInteractionMgr.GetInteractionByIndex(i); if (interaction.IsActive() && interaction.TagsContain("Navigation")) { // Get fly mode vrProperty flyProp = interaction.GetProperty("Fly"); if (flyProp != null) { fly = flyProp.GetBool(); } // Get navigation node vrProperty navNodeProp = interaction.GetProperty("NavigationNode"); if (navNodeProp != null) { navNodeMVR = MiddleVR.VRDisplayMgr.GetNode(navNodeProp.GetObject().GetName()); } break; } } if (navNodeMVR == null) { MVRTools.Log(2, "[X] VRNavigationCollision: impossible to retrieve navigation node."); return; } // Initialize parameters from found ones SetCollisionNode(GameObject.Find(CollisionNodeName)); SetNavigationNode(navNodeMVR); SetFly(fly); // Try to start the collisions Initialize(); }
public void CreateInteractionToggleButton(vrInteraction iInteraction, string iButtonName, vrWidgetMenu iParentMenu, vrCommand.Delegate iButtonHandler) { string itName = iInteraction.GetName(); vrCommand newCommand = new vrCommand("VRMenu." + itName + "ToggleCommand", iButtonHandler); m_Commands.Add(itName, newCommand); vrWidgetToggleButton button = new vrWidgetToggleButton("VRMenu." + itName + "ToggleButton", iParentMenu, iButtonName, newCommand, iInteraction.IsActive()); m_Buttons.Add(itName, button); }
public void CreateInteractionToggleButton(vrInteraction iInteraction, string iButtonName, vrWidgetMenu iParentMenu, string iButtonHandlerName) { string itName = iInteraction.GetName(); vrWidgetToggleButton button = new vrWidgetToggleButton("VRMenu." + itName + "ToggleButton", iParentMenu, iButtonName, MVRTools.GetCommand(iButtonHandlerName), iInteraction.IsActive()); m_Buttons.Add(itName, button); MVRTools.RegisterObject(this, button); }