Пример #1
0
        void UpdateExtensionStates()
        {
            if (ms_enabled)
            {
                if (!m_leapActive)
                {
                    m_leapController.StartConnection();
                    m_leapActive = true;
                }
                if (m_vr)
                {
                    m_leapController.SetPolicy(Leap.Controller.PolicyFlag.POLICY_OPTIMIZE_HMD);
                }
                else
                {
                    m_leapController.ClearPolicy(Leap.Controller.PolicyFlag.POLICY_OPTIMIZE_HMD);
                }
            }
            else
            {
                if (m_leapActive)
                {
                    m_leapController.StopConnection();
                    m_leapActive = false;
                }

                // Reset HandGestureController, IKSolverVR resets itself
                var l_controller = VRCPlayer.field_Internal_Static_VRCPlayer_0?.field_Private_VRC_AnimationController_0?.field_Private_HandGestureController_0;
                if (l_controller != null)
                {
                    l_controller.field_Internal_Boolean_0 = false;
                    l_controller.field_Private_EnumNPublicSealedvaKeMoCoGaViOcViDaWaUnique_0 = VRCInputManager.EnumNPublicSealedvaKeMoCoGaViOcViDaWaUnique.Mouse;
                }
            }
        }
Пример #2
0
        /* Policy setting requests
         * A request to change a policy is subject to user approval and a policy can be changed by the user at any time
         * (using the Leap Motion settings dialog).
         * The desired policy flags must be set every time an application runs.
         * Policy changes are completed asynchronously and, because they are subject to user approval or system compatibility checks, may not complete successfully.
         * Call Controller::isPolicySet() after a suitable interval to test whether the change was accepted.
         */

        public static void SetPolicy(Leap.Controller controller, out Leap.Controller controllerOut, PolicyFlag policy, bool set)
        {
            controllerOut = controller;
            if (set)
            {
                controller.SetPolicy((Leap.Controller.PolicyFlag)policy);
            }
            else
            {
                controller.ClearPolicy((Leap.Controller.PolicyFlag)policy);
            }
        }