private bool EventListener(vrEvent iEvent) { vrInteractionEvent evt = vrInteractionEvent.Cast(iEvent); if (evt == null) { return false; } vrInteraction evtInteraction = evt.GetInteraction(); if (m_Interaction != null && evtInteraction != null && evt != null && evtInteraction.GetId() == m_Interaction.GetId()) { var eventType = evt.GetEventType(); if (eventType == (int)VRInteractionEventEnum.VRInteractionEvent_Activated) { Activate(); } else if (eventType == (int)VRInteractionEventEnum.VRInteractionEvent_Deactivated) { Deactivate(); } } return true; }
private bool EventListener(vrEvent iEvent) { vrInteractionEvent evt = vrInteractionEvent.Cast(iEvent); if (evt == null) { return(false); } vrInteraction evtInteraction = evt.GetInteraction(); if (m_Interaction != null && evtInteraction != null && evt != null && evtInteraction.GetId() == m_Interaction.GetId()) { var eventType = evt.GetEventType(); if (eventType == (int)VRInteractionEventEnum.VRInteractionEvent_Activated) { Activate(); } else if (eventType == (int)VRInteractionEventEnum.VRInteractionEvent_Deactivated) { Deactivate(); } } return(true); }
private bool EventListener(vrEvent iEvent) { // Catch interaction events vrInteractionEvent interactionEvt = vrInteractionEvent.Cast(iEvent); if (interactionEvt != null) { vrInteraction interaction = interactionEvt.GetInteraction(); bool needLabelRefresh = false; // Identify interaction // If existing in the Menu, update the menu if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Activated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(true); } needLabelRefresh = true; } else if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Deactivated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(false); } needLabelRefresh = true; } // Refresh interaction menu label if activated or deactivated if (needLabelRefresh) { if (interaction.TagsContain("ContinuousNavigation")) { _RefreshNavigationMenuName(); } else if (interaction.TagsContain("ContinuousManipulation")) { _RefreshManipulationMenuName(); } else if (interaction.TagsContain("VirtualHand")) { _RefreshVirtualHandMenuName(); } } } return(true); }
private bool EventListener(vrEvent iEvent) { // Catch interaction events vrInteractionEvent interactionEvt = vrInteractionEvent.Cast(iEvent); if (interactionEvt != null) { vrInteraction interaction = interactionEvt.GetInteraction(); bool needLabelRefresh = false; // Identify interaction // If existing in the Menu, update the menu if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Activated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(true); } needLabelRefresh = true; } else if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Deactivated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(false); } needLabelRefresh = true; } // Refresh interaction menu label if activated or deactivated if (needLabelRefresh) { if (interaction.TagsContain("ContinuousNavigation")) { _RefreshNavigationMenuName(); } else if (interaction.TagsContain("ContinuousManipulation")) { _RefreshManipulationMenuName(); } else if (interaction.TagsContain("VirtualHand")) { _RefreshVirtualHandMenuName(); } } } return true; }
private bool OnMVRNodeDestroy(vrEvent iBaseEvt) { vrObjectEvent e = vrObjectEvent.Cast(iBaseEvt); if (e != null) { if (e.ComesFrom(m_PhysicsConstraint)) { if (e.eventType == (int)VRObjectEventEnum.VRObjectEvent_Destroy) { // Killed in MiddleVR so delete it in C#. m_PhysicsConstraint.Dispose(); } } } return(true); }
private bool OnMVRNodeDestroy(vrEvent iBaseEvt) { vrObjectEvent e = vrObjectEvent.Cast(iBaseEvt); if (e != null) { if (e.ComesFrom(m_RigidBody)) { if (e.eventType == (int)VRObjectEventEnum.VRObjectEvent_Destroy) { // The physics rigid body was killed in MiddleVR so // stop to use it in C#. m_RigidBody = null; // And even stop to use this component. enabled = false; } } } return(true); }
private bool EventListener(vrEvent iEvent) { // Catch interaction events vrInteractionEvent interactionEvt = vrInteractionEvent.Cast(iEvent); if (interactionEvt != null) { vrInteraction interaction = interactionEvt.GetInteraction(); bool needLabelRefresh = false; // Identify interaction // If existing in the Menu, update the menu if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Activated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(true); } needLabelRefresh = true; } else if (interactionEvt.GetEventType() == (int)VRInteractionEventEnum.VRInteractionEvent_Deactivated) { vrWidgetToggleButton interactionButton; if (m_Buttons.TryGetValue(interaction.GetName(), out interactionButton)) { interactionButton.SetChecked(false); } needLabelRefresh = true; } } return(true); }
private bool _OnNodeEvent(vrEvent iEvent) { if (!m_IsNodeGrabbed) { vrObjectEvent objectEvent = vrObjectEvent.Cast(iEvent); if (objectEvent != null && objectEvent.GetEventType() == (int)VRObjectEventEnum.VRObjectEvent_Destroy) { MVRNodesMapper nodesMapper = MVRNodesMapper.Instance; if (nodesMapper != null && m_SyncDirection != MVRNodesMapper.ENodesSyncDirection.NoSynchronization) { nodesMapper.RemoveMapping(gameObject, false); } SetSyncDirection(MVRNodesMapper.ENodesSyncDirection.NoSynchronization); m_Node = null; // Destroys the object later this frame, before rendering UnityEngine.Object.Destroy(gameObject); } } return(true); }
private bool OnMVRNodeDestroy(vrEvent iBaseEvt) { vrObjectEvent e = vrObjectEvent.Cast(iBaseEvt); if (e != null) { if (e.ComesFrom(m_PhysicsConstraint)) { if (e.eventType == (int)VRObjectEventEnum.VRObjectEvent_Destroy) { // Killed in MiddleVR so delete it in C#. m_PhysicsConstraint.Dispose(); } } } return true; }
private bool OnMVRNodeDestroy(vrEvent iBaseEvt) { vrObjectEvent e = vrObjectEvent.Cast(iBaseEvt); if (e != null) { if (e.ComesFrom(m_RigidBody)) { if (e.eventType == (int)VRObjectEventEnum.VRObjectEvent_Destroy) { // The physics rigid body was killed in MiddleVR so // stop to use it in C#. m_RigidBody = null; // And even stop to use this component. enabled = false; } } } return true; }