private void Start() { recognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); recognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.Tap); recognizer.TappedEvent += Recognizer_TappedEvent; recognizer.StartCapturingGestures(); }
private HoloGazeManager() { //head instance. Head = new Misc.HoloHead(); //Gaze hit instance. GazeHit = new HoloGazeHit(); //gesture recognizer. _gestureRecognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); //set recognizable gestures. _gestureRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.Tap | UnityEngine.VR.WSA.Input.GestureSettings.Hold | UnityEngine.VR.WSA.Input.GestureSettings.ManipulationTranslate | UnityEngine.VR.WSA.Input.GestureSettings.DoubleTap); //attach listeners. _gestureRecognizer.TappedEvent += OnTapEvent; _gestureRecognizer.HoldStartedEvent += OnHoldStartedEvent; _gestureRecognizer.HoldCompletedEvent += OnHoldCompletedEvent; _gestureRecognizer.ManipulationStartedEvent += OnManipulationStartedEvent; _gestureRecognizer.ManipulationUpdatedEvent += OnManipulationUpdateEvent; _gestureRecognizer.ManipulationCompletedEvent += OnManipulationEndedEvent; //start recognizing. _gestureRecognizer.StartCapturingGestures(); }
protected override void Start() { base.Start(); gestureRecognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); gestureRecognizer.TappedEvent += OnTappedEvent; gestureRecognizer.HoldStartedEvent += OnHoldStartedEvent; gestureRecognizer.HoldCompletedEvent += OnHoldCompletedEvent; gestureRecognizer.HoldCanceledEvent += OnHoldCanceledEvent; gestureRecognizer.ManipulationStartedEvent += OnManipulationStartedEvent; gestureRecognizer.ManipulationUpdatedEvent += OnManipulationUpdatedEvent; gestureRecognizer.ManipulationCompletedEvent += OnManipulationCompletedEvent; gestureRecognizer.ManipulationCanceledEvent += OnManipulationCanceledEvent; gestureRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.Tap | UnityEngine.VR.WSA.Input.GestureSettings.ManipulationTranslate | UnityEngine.VR.WSA.Input.GestureSettings.Hold); // We need a separate gesture recognizer for navigation, since it isn't compatible with manipulation navigationGestureRecognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); navigationGestureRecognizer.NavigationStartedEvent += OnNavigationStartedEvent; navigationGestureRecognizer.NavigationUpdatedEvent += OnNavigationUpdatedEvent; navigationGestureRecognizer.NavigationCompletedEvent += OnNavigationCompletedEvent; navigationGestureRecognizer.NavigationCanceledEvent += OnNavigationCanceledEvent; if (UseRailsNavigation) { navigationGestureRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.NavigationRailsX | UnityEngine.VR.WSA.Input.GestureSettings.NavigationRailsY | UnityEngine.VR.WSA.Input.GestureSettings.NavigationRailsZ); } else { navigationGestureRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.NavigationX | UnityEngine.VR.WSA.Input.GestureSettings.NavigationY | UnityEngine.VR.WSA.Input.GestureSettings.NavigationZ); } if (RecognizerStart == RecognizerStartBehavior.AutoStart) { gestureRecognizer.StartCapturingGestures(); navigationGestureRecognizer.StartCapturingGestures(); } }
void Start() { // Create a new GestureRecognizer. Sign up for tapped events. ClickRecognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); ClickRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.Tap); ClickRecognizer.TappedEvent += ClickRecognizer_TappedEvent; // Move Gesture MoveRecognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); MoveRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.ManipulationTranslate); MoveRecognizer.ManipulationStartedEvent += MoveRecognizer_ManipulationStartedEvent; MoveRecognizer.ManipulationUpdatedEvent += MoveRecognizer_ManipulationUpdatedEvent; MoveRecognizer.ManipulationCompletedEvent += MoveRecognizer_ManipulationCompletedEvent; MoveRecognizer.ManipulationCanceledEvent += MoveRecognizer_ManipulationCanceledEvent; // Rotate Gestrue RotateRecognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); RotateRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.NavigationX); RotateRecognizer.NavigationStartedEvent += RotateRecognizer_NavigationStartedEvent; RotateRecognizer.NavigationUpdatedEvent += RotateRecognizer_NavigationUpdatedEvent; RotateRecognizer.NavigationCompletedEvent += RotateRecognizer_NavigationCompletedEvent; RotateRecognizer.NavigationCanceledEvent += RotateRecognizer_NavigationCanceledEvent; // Zoom Gesture ZoomRecognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); ZoomRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.NavigationY); ZoomRecognizer.NavigationStartedEvent += ZoomRecognizer_NavigationStartedEvent; ZoomRecognizer.NavigationUpdatedEvent += ZoomRecognizer_NavigationUpdatedEvent; ZoomRecognizer.NavigationCompletedEvent += ZoomRecognizer_NavigationCompletedEvent; ZoomRecognizer.NavigationCanceledEvent += ZoomRecognizer_NavigationCanceledEvent; // Save Gesture SaveRecognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); SaveRecognizer.SetRecognizableGestures(UnityEngine.VR.WSA.Input.GestureSettings.Tap); SaveRecognizer.TappedEvent += SaveRecognizer_TappedEvent; // Start looking for gestures. IsClicking = true; ActiveRecognizer = ClickRecognizer; ActiveRecognizer.StartCapturingGestures(); }