SHARE
TWEET

Untitled

a guest Jul 17th, 2017 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using UnityEngine.VR.WSA.Input;
  3.  
  4. /*
  5.  * This a custom take on the gesture recognizing system for the HoloLens provided by Microsoft.
  6.  * Use this as a reference point for future development and as a basis for new projects.
  7.  * This file might be subject to changes.
  8.  * Feel free to copy and paste this file and create your own version of this.
  9.  */
  10.  
  11. public class BasicGestureManager : MonoBehaviour
  12. {
  13.     // Declaring the gesture recognizer
  14.     private GestureRecognizer recognizer;
  15.  
  16.     void Start ()
  17.     {        
  18.         recognizer = new GestureRecognizer(); // Invoking new GestureRecognizer
  19.         recognizer.SetRecognizableGestures(GestureSettings.Tap); // Set this to tap to recognize incoming taps
  20.         // Choose any other gesture contained in GestureSettings and adjust settings accordingly if you want
  21.         recognizer.TappedEvent += OnTap; // This might look weird though all it does is assigning a function as a handler when recognizing a tapping event
  22.         recognizer.StartCapturingGestures(); // When configured correctly start recognizing gestures
  23.     }
  24.  
  25.     private void OnTap(InteractionSourceKind source, int tapCount, Ray headRay)
  26.     {        
  27.         // ---> Code to be executed when a gesture (tap) is recognized goes here <---    
  28.     }
  29. }
RAW Paste Data
Top