Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.VR.WSA.Input;
- /*
- * This a custom take on the gesture recognizing system for the HoloLens provided by Microsoft.
- * Use this as a reference point for future development and as a basis for new projects.
- * This file might be subject to changes.
- * Feel free to copy and paste this file and create your own version of this.
- */
- public class BasicGestureManager : MonoBehaviour
- {
- // Declaring the gesture recognizer
- private GestureRecognizer recognizer;
- void Start ()
- {
- recognizer = new GestureRecognizer(); // Invoking new GestureRecognizer
- recognizer.SetRecognizableGestures(GestureSettings.Tap); // Set this to tap to recognize incoming taps
- // Choose any other gesture contained in GestureSettings and adjust settings accordingly if you want
- recognizer.TappedEvent += OnTap; // This might look weird though all it does is assigning a function as a handler when recognizing a tapping event
- recognizer.StartCapturingGestures(); // When configured correctly start recognizing gestures
- }
- private void OnTap(InteractionSourceKind source, int tapCount, Ray headRay)
- {
- // ---> Code to be executed when a gesture (tap) is recognized goes here <---
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement