翻译微软官方HoloLens开发课程 手势识别

xiaoxiao2021-02-28  101

改脚本挂在摄像机上

using System.Collections;

using System.Collections.Generic; using UnityEngine; using UnityEngine.VR.WSA.Input; public class GestureManagerrr : MonoBehaviour {     GestureRecognizer gesture; // Use this for initialization void Start () {         gesture = new GestureRecognizer();         gesture.TappedEvent += Gesture_TappedEvent;//手势点击         gesture.StartCapturingGestures();//开启手势捕捉     }          private void Gesture_TappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)     {         FindObjectOfType<Cbuerrr>().OnTapped();       }

}

此脚本挂在Cube上

using System.Collections; using System.Collections.Generic; using UnityEngine; public class Cbuerrr : MonoBehaviour {     public void OnTapped()     {         gameObject.SetActive(false);     } }

转载请注明原文地址: https://www.6miu.com/read-71466.html

最新回复(0)