static void UpdateInteractionState(ref InteractionState interactionState, bool isInteractionStateOn)
        {
            bool previousActive = interactionState.active;

            interactionState.active = isInteractionStateOn;

            if (interactionState.active && !previousActive)
            {
                interactionState.activatedThisFrame = true;
            }
            else if (!interactionState.active && previousActive)
            {
                interactionState.deActivatedThisFrame = true;
            }
        }
Beispiel #2
0
        void HandleInteractionAction(XRNode node, string usage, ref InteractionState interactionState)
        {
            float value = 0.0f;

            if (inputDevice.isValid && inputDevice.TryGetFeatureValue(new InputFeatureUsage <float>(usage), out value) &&
                value >= m_AxisToPressThreshold)
            {
                if (!interactionState.active)
                {
                    interactionState.activatedThisFrame = true;
                    interactionState.active             = true;
                }
            }
            else
            {
                if (interactionState.active)
                {
                    interactionState.deActivatedThisFrame = true;
                    interactionState.active = false;
                }
            }
        }
        void HandleInteractionAction(XRNode node, InputHelpers.Button button, ref InteractionState interactionState)
        {
            bool pressed = false;

            inputDevice.IsPressed(button, out pressed, m_AxisToPressThreshold);

            if (pressed)
            {
                if (!interactionState.active)
                {
                    interactionState.activatedThisFrame = true;
                    interactionState.active             = true;
                }
            }
            else
            {
                if (interactionState.active)
                {
                    interactionState.deActivatedThisFrame = true;
                    interactionState.active = false;
                }
            }
        }
Beispiel #4
0
        void HandleInteractionAction(XRNode node, InputHelpers.Button button, ref InteractionState interactionState)
        {
            bool pressed = false;
            //inputDevice.IsPressed(button, out pressed, m_AxisToPressThreshold);
            float indexPinch = ovrHand.GetFingerPinchStrength(OVRHand.HandFinger.Index);

            pressed = indexPinch > 0.9f;
            if (pressed)
            {
                if (!interactionState.active)
                {
                    interactionState.activatedThisFrame = true;
                    interactionState.active             = true;
                }
            }
            else
            {
                if (interactionState.active)
                {
                    interactionState.deActivatedThisFrame = true;
                    interactionState.active = false;
                }
            }
        }