// Start is called before the first frame update
 void Start()
 {
     profilerButton.IsToggled   = (CoreServices.DiagnosticsSystem?.ShowProfiler).GetValueOrDefault(false);
     handRayButton.IsToggled    = PointerUtils.GetPointerBehavior <ShellHandRayPointer>(Handedness.Any, InputSourceType.Hand) != PointerBehavior.AlwaysOff;
     handMeshButton.IsToggled   = (CoreServices.InputSystem?.InputSystemProfile?.HandTrackingProfile.EnableHandMeshVisualization).GetValueOrDefault(false);
     handJointsButton.IsToggled = (CoreServices.InputSystem?.InputSystemProfile?.HandTrackingProfile.EnableHandJointVisualization).GetValueOrDefault(false);
 }
 private void SetToggleHelper <T>(Interactable toggle, string toggleName, InputSourceType inputType) where T : class, IMixedRealityPointer
 {
     if (toggle == null)
     {
         Debug.LogWarning($"Button {toggleName} is null on GameObject {gameObject.name}. Did you forget to set it?");
     }
     else
     {
         toggle.IsToggled = PointerUtils.GetPointerBehavior <T>(Handedness.Any, inputType) != PointerBehavior.AlwaysOff;
     }
 }
        private void Start()
        {
            profilerButton.IsToggled = (CoreServices.DiagnosticsSystem?.ShowProfiler).GetValueOrDefault(false);
            handRayButton.IsToggled  = PointerUtils.GetPointerBehavior <ShellHandRayPointer>(Handedness.Any, InputSourceType.Hand) != PointerBehavior.AlwaysOff;

            MixedRealityHandTrackingProfile handProfile = null;

            if (CoreServices.InputSystem?.InputSystemProfile != null)
            {
                handProfile = CoreServices.InputSystem.InputSystemProfile.HandTrackingProfile;
            }
            handMeshButton.IsToggled   = handProfile != null && handProfile.EnableHandMeshVisualization;
            handJointsButton.IsToggled = handProfile != null && handProfile.EnableHandJointVisualization;
        }
Example #4
0
        /// <summary>
        /// Toggles a pointer's "enabled" behavior. If a pointer's <see cref="Microsoft.MixedReality.Toolkit.Input.PointerBehavior"/> is Default or AlwaysOn,
        /// set it to AlwaysOff. Otherwise, set the pointer's behavior to Default.
        /// Will set this state for all matching pointers.
        /// </summary>
        /// <typeparam name="T">Type of pointer to set</typeparam>
        /// <param name="inputType">Input type of pointer to set</param>
        public void TogglePointerEnabled <T>(InputSourceType inputType) where T : class, IMixedRealityPointer
        {
            PointerBehavior oldBehavior = PointerUtils.GetPointerBehavior <T>(Handedness.Any, inputType);
            PointerBehavior newBehavior;

            if (oldBehavior == PointerBehavior.AlwaysOff)
            {
                newBehavior = PointerBehavior.Default;
            }
            else
            {
                newBehavior = PointerBehavior.AlwaysOff;
            }
            PointerUtils.SetPointerBehavior <T>(newBehavior, inputType);
        }