using Microsoft.MixedReality.Toolkit;
using Microsoft.MixedReality.Toolkit.Input;
using UnityEngine;
namespace MRTK.Tools
{
[AddComponentMenu("AddScript/MRTKTools/SetHandVisualisation")]
public class SetHandVisualisation : MonoBehaviour
{
public void ToggleHandMesh()
{
MixedRealityInputSystemProfile inputSystemProfile = CoreServices.InputSystem?.InputSystemProfile;
if (inputSystemProfile == null)
return;
MixedRealityHandTrackingProfile handTrackingProfile = inputSystemProfile.HandTrackingProfile;
if (handTrackingProfile != null)
handTrackingProfile.EnableHandMeshVisualization = !handTrackingProfile.EnableHandMeshVisualization;
}
public void ToggleHandJoint()
{
MixedRealityHandTrackingProfile handTrackingProfile = null;
if (CoreServices.InputSystem?.InputSystemProfile != null)
handTrackingProfile = CoreServices.InputSystem.InputSystemProfile.HandTrackingProfile;
if (handTrackingProfile != null)
handTrackingProfile.EnableHandJointVisualization = !handTrackingProfile.EnableHandJointVisualization;
}
public void ShowHandMesh(bool isShow)
{
MixedRealityInputSystemProfile inputSystemProfile = CoreServices.InputSystem?.InputSystemProfile;
if (inputSystemProfile == null)
{
return;
}
MixedRealityHandTrackingProfile handTrackingProfile = inputSystemProfile.HandTrackingProfile;
if (handTrackingProfile != null)
{
handTrackingProfile.EnableHandMeshVisualization = isShow;
}
}
public void ShowHandJoint(bool isShow)
{
MixedRealityHandTrackingProfile handTrackingProfile = null;
if (CoreServices.InputSystem?.InputSystemProfile != null)
{
handTrackingProfile = CoreServices.InputSystem.InputSystemProfile.HandTrackingProfile;
if (handTrackingProfile != null)
{
handTrackingProfile.EnableHandJointVisualization = isShow;
}
}
}
}
}
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;
namespace MRTK.Tools
{
[AddComponentMenu("AddScript/MRTKTools/SetPointerBehavior")]
public class SetPointerBehavior : MonoBehaviour
{
private 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);
}
public void ToggleHandRayEnabled()
{
TogglePointerEnabled<ShellHandRayPointer>(InputSourceType.Hand);
}
public void SetHandRayEnable(bool isEnable)
{
PointerBehavior point;
point = isEnable ? PointerBehavior.Default : PointerBehavior.AlwaysOff;
PointerUtils.SetPointerBehavior<ShellHandRayPointer>(point, InputSourceType.Hand);
}
}
}
using Microsoft.MixedReality.Toolkit;
using UnityEngine;
namespace MRTK.Tools
{
[AddComponentMenu("AddScript/MRTKTools/SetProfilerVisual")]
public class SetProfilerVisual : MonoBehaviour
{
public void ToggleProfilerVisibility()
{
if (CoreServices.DiagnosticsSystem != null)
{
CoreServices.DiagnosticsSystem.ShowProfiler = !CoreServices.DiagnosticsSystem.ShowProfiler;
}
}
public void SetProfilerVisibility(bool isVisible)
{
if (CoreServices.DiagnosticsSystem != null)
{
CoreServices.DiagnosticsSystem.ShowProfiler = isVisible;
}
}
}
}