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 Awake() { base.Awake(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// recognizer = new UnityEngine.VR.WSA.Input.GestureRecognizer(); recognizer.TappedEvent += (source, tapCount, ray) => { // Send an OnSelect message to the focused object and its ancestors. if (previousFocusObject != null) { previousFocusObject.SendMessageUpwards("OnSelect"); } }; recognizer.StartCapturingGestures(); // Add default RaycastLayers as first layerPriority if (RaycastLayerMasks == null || RaycastLayerMasks.Length == 0) { RaycastLayerMasks = new LayerMask[] { Physics.DefaultRaycastLayers }; } if (GazeTransform == null) { if (Camera.main != null) { GazeTransform = Camera.main.transform; } else { Debug.LogError("Gaze Manager was not given a GazeTransform and no main camera exists to default to."); } } }
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(); }
// Transfer from one gesture module to another one. public void Transition(UnityEngine.VR.WSA.Input.GestureRecognizer newRecognizer) { if (newRecognizer == null) { return; } if (ActiveRecognizer != null) { if (ActiveRecognizer == newRecognizer) { return; } ActiveRecognizer.CancelGestures(); ActiveRecognizer.StopCapturingGestures(); } newRecognizer.StartCapturingGestures(); ActiveRecognizer = newRecognizer; if (ActiveRecognizer == ClickRecognizer) { IsClicking = true; } else { IsClicking = false; } if (ActiveRecognizer == SaveRecognizer) { DebugInfoManager.Instance.UpdateSavePointsStatus(true); } else { DebugInfoManager.Instance.UpdateSavePointsStatus(false); } }