Exemple #1
0
 /// <summary>
 /// Sets pointer behavior to mimic HoloLens 2
 /// PokePointer will be Default
 /// GrabPointer will be Default
 /// HandRayPointer will be Default
 /// MotionControllerRayPointer will be off
 /// GazePointer will be Off
 /// </summary>
 public void SetHoloLens2()
 {
     PointerUtils.SetHandPokePointerBehavior(PointerBehavior.Default, Handedness.Any);
     PointerUtils.SetHandGrabPointerBehavior(PointerBehavior.Default, Handedness.Any);
     PointerUtils.SetHandRayPointerBehavior(PointerBehavior.Default, Handedness.Any);
     PointerUtils.SetMotionControllerRayPointerBehavior(PointerBehavior.AlwaysOff, Handedness.Any);
     PointerUtils.SetGazePointerBehavior(PointerBehavior.AlwaysOff);
 }
        public IEnumerator TestPoke()
        {
            var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

            cube.AddComponent <NearInteractionTouchableVolume>();
            cube.transform.position = Vector3.forward * 0.5f;

            TestHand rightHand = new TestHand(Handedness.Right);
            TestHand leftHand  = new TestHand(Handedness.Left);

            TestContext.Out.WriteLine("Show both hands near touchable cube");
            yield return(rightHand.Show(Vector3.zero));

            yield return(leftHand.Show(Vector3.zero));

            yield return(new WaitForFixedUpdate());

            PointerStateContainer touchOn = new PointerStateContainer()
            {
                GazePointerEnabled   = false,
                GGVPointerEnabled    = null,
                PokePointerEnabled   = true,
                SpherePointerEnabled = false,
                LinePointerEnabled   = false
            };

            EnsurePointerStates(Handedness.Right, touchOn);
            EnsurePointerStates(Handedness.Left, touchOn);

            TestContext.Out.WriteLine("Turn off poke pointer right hand");
            PointerUtils.SetHandPokePointerBehavior(PointerBehavior.AlwaysOff, Handedness.Right);
            yield return(null);

            PointerStateContainer touchOff = new PointerStateContainer()
            {
                GazePointerEnabled   = false,
                GGVPointerEnabled    = null,
                PokePointerEnabled   = false,
                SpherePointerEnabled = false,
                LinePointerEnabled   = true
            };

            EnsurePointerStates(Handedness.Right, touchOff);
            EnsurePointerStates(Handedness.Left, touchOn);

            TestContext.Out.WriteLine("Turn off poke pointer both hands");
            PointerUtils.SetHandPokePointerBehavior(PointerBehavior.AlwaysOff);
            yield return(null);

            EnsurePointerStates(Handedness.Right, touchOff);
            EnsurePointerStates(Handedness.Left, touchOff);
        }
Exemple #3
0
 /// <summary>
 /// Sets the <see cref="Microsoft.MixedReality.Toolkit.Input.PointerBehavior"/> for the poke pointer to be AlwaysOff
 /// <param name="isEnabled">If true, behavior will be set to Default.
 /// Otherwise it will be set to AlwaysOff</param>
 /// </summary>
 public void SetPokeEnabled(bool isEnabled)
 {
     PointerUtils.SetHandPokePointerBehavior(isEnabled ? PointerBehavior.Default : PointerBehavior.AlwaysOff, Handedness.Any);
 }