private void ProcessThumbstickInput()
        {
            float horAxis = webXRController.GetAxisIndexValue(2); //webXRController.GetAxis("ThumbstickX");

            float verAxis = webXRController.GetAxisIndexValue(3); //webXRController.GetAxis("ThumbstickY");

            //Reset Horizontal Flick
            if (horAxis >= -0.5f && horAxis <= 0.5f)
            {
                isHorAxisReset = true;
            }

            //Left flick
            if (horAxis < -0.5f && isHorAxisReset)
            {
                isHorAxisReset = false;

                onRightFlick.Invoke();
            }

            //Right flick
            if (horAxis > 0.5f && isHorAxisReset)
            {
                isHorAxisReset = false;

                onLeftFlick.Invoke();
            }

            //Reset Vertical Flick
            if (verAxis >= -0.5f && verAxis <= 0.5f)
            {
                isVerAxisReset = true;
            }

            if (verAxis < -0.5f && isVerAxisReset)
            {
                isVerAxisReset = false;

                onDownFlick.Invoke();
            }

            if (verAxis > 0.5f && isVerAxisReset)
            {
                isVerAxisReset = false;

                onUpFlick.Invoke();
            }

            if (webXRController.GetButtonDown(WebXRController.ButtonTypes.Thumbstick))
            {
                onThumbstickButtonDown.Invoke();
            }

            if (webXRController.GetButtonUp(WebXRController.ButtonTypes.Thumbstick))
            {
                onThumbstickButtonUp.Invoke();
            }
        }
        public void OnUpdate(float realTime)
        {
            #region Hand Velocity Information
            //to enable throwing physics objects
            if (currentTransform)
            {
                if (currentRB)
                {
                    newPos = thisTransform.position;
                    var dif = newPos - oldPos;
                    velocity = dif / Time.deltaTime;
                    oldPos   = newPos;
                }
            }
            #endregion

            #region Hand Input Calls

            float hand_Anim_NormalizedTime = webXRController.GetButton(WebXRController.ButtonTypes.Trigger) ? 1 : webXRController.GetAxis(WebXRController.AxisTypes.Grip);

            //Set anim current state depending on grip and trigger pressure
            thisAnimCont.Play("Take", -1, hand_Anim_NormalizedTime);

            if (webXRController.GetButtonDown(WebXRController.ButtonTypes.Grip))
            {
                onGripButtonDown.Invoke();
                PickUp();


                if (firstControllerInteraction == this)
                {
                    DoubleTapState.Instance.leftHandGripPressed = true;
                }

                if (secondControllerInteraction == this)
                {
                    DoubleTapState.Instance.rightHandGripPressed = true;
                }

                if (DoubleTapState.Instance.leftHandGripPressed == true && DoubleTapState.Instance.rightHandGripPressed == true)
                {
                    DoubleTapState.Instance.OnDoubleGripStateOn?.Invoke();
                }
            }

            if (webXRController.GetButtonUp(WebXRController.ButtonTypes.Grip))
            {
                onGripButtonUp.Invoke();
                Drop();


                if (firstControllerInteraction == this)
                {
                    DoubleTapState.Instance.leftHandGripPressed = false;
                }

                if (secondControllerInteraction == this)
                {
                    DoubleTapState.Instance.rightHandGripPressed = false;
                }

                DoubleTapState.Instance.OnDoubleGripStateOff?.Invoke();
            }

            if (webXRController.GetButtonUp(WebXRController.ButtonTypes.Trigger))
            {
                onTriggerButtonUp.Invoke();

                //set the state of our current controller press
                if (firstControllerInteraction == this)
                {
                    DoubleTapState.Instance.leftHandTriggerPressed = false;
                }

                if (secondControllerInteraction == this)
                {
                    DoubleTapState.Instance.rightHandTriggerPressed = false;
                }


                DoubleTapState.Instance.OnDoubleTriggerStateOff?.Invoke();
                //if (DoubleTapState.Instance.leftHandTrigger == false && DoubleTapState.Instance.rightHandTrigger == false)
                //    DoubleTapState.Instance.OnDoubleGripStateOff?.Invoke();
                //.gripTicks = -1;
            }

            if (webXRController.GetButtonDown(WebXRController.ButtonTypes.Trigger))
            {
                onTriggerButtonDown.Invoke();


                if (firstControllerInteraction == this)
                {
                    DoubleTapState.Instance.leftHandTriggerPressed = true;
                }

                if (secondControllerInteraction == this)
                {
                    DoubleTapState.Instance.rightHandTriggerPressed = true;
                }

                if (DoubleTapState.Instance.leftHandTriggerPressed == true && DoubleTapState.Instance.rightHandTriggerPressed == true)
                {
                    DoubleTapState.Instance.OnDoubleTriggerStateOn?.Invoke();
                }
            }

            //A button - primarybutton
            if (webXRController.GetButtonDown(WebXRController.ButtonTypes.ButtonA))
            {
                onPrimaryButtonDown.Invoke();
            }

            if (webXRController.GetButtonUp(WebXRController.ButtonTypes.ButtonA))
            {
                onPrimaryButtonUp.Invoke();
            }

            if (webXRController.GetButtonDown(WebXRController.ButtonTypes.ButtonB))
            {
                onSecondaryButtonDown.Invoke();
            }

            if (webXRController.GetButtonUp(WebXRController.ButtonTypes.ButtonB))
            {
                onSecondaryButtonUp.Invoke();
            }

            float horAxis = webXRController.GetAxisIndexValue(2); //webXRController.GetAxis("ThumbstickX");
            float verAxis = webXRController.GetAxisIndexValue(3); //webXRController.GetAxis("ThumbstickY");

            //Reset Horizontal Flick
            if (horAxis >= -0.5f && horAxis <= 0.5f)
            {
                isHorAxisReset = true;
            }

            //Left flick
            if (horAxis < -0.5f && isHorAxisReset)
            {
                isHorAxisReset = false;
                onRightFlick.Invoke();
            }

            //Right flick
            if (horAxis > 0.5f && isHorAxisReset)
            {
                isHorAxisReset = false;
                onLeftFlick.Invoke();
            }

            //Reset Vertical Flick
            if (verAxis >= -0.5f && verAxis <= 0.5f)
            {
                isVerAxisReset = true;
            }

            if (verAxis < -0.5f && isVerAxisReset)
            {
                isVerAxisReset = false;
                onDownFlick.Invoke();
            }

            if (verAxis > 0.5f && isVerAxisReset)
            {
                isVerAxisReset = false;
                onUpFlick.Invoke();
            }

            if (webXRController.GetButtonDown(WebXRController.ButtonTypes.Thumbstick))
            {
                onThumbstickButtonDown.Invoke();
            }

            if (webXRController.GetButtonUp(WebXRController.ButtonTypes.Thumbstick))
            {
                onThumbstickButtonUp.Invoke();
            }
            #endregion
        }
 private void SetAxisValue(int index)
 {
     inputProfileModel.SetAxisValue(index, controller.GetAxisIndexValue(index));
 }