// Start is called before the first frame update void Start() { if (customGestureManager != null) //if an instance of custom gesture manager already exists { Destroy(this); //destroy this script } customGestureManager = this; //set the singleton kinect = KinectSensor.GetDefault(); //get the kinect gestureDatabase = VisualGestureBuilderDatabase.Create(Application.streamingAssetsPath + "/" + databaseName + ".gbd"); //get the database gestureFrameSource = VisualGestureBuilderFrameSource.Create(kinect, 0); //create the frame source Pose[] poses = GameObject.FindObjectsOfType <Pose>(); foreach (var gesture in gestureDatabase.AvailableGestures) { for (int i = 0; i < poses.Length; i++) { if (gesture.Name.Equals(poses[i].GetGestureName())) { CustomGesture tempGesture;//create the new struct tempGesture.gesture = gesture; tempGesture.mesh = poses[i].GetMesh(); gestures.Add(tempGesture);//add it to the list } } // Debug.Log(gesture.Name); gestureFrameSource.AddGesture(gesture);//add all the available gestures in the database to the frame source } gestureFrameReader = gestureFrameSource.OpenReader(); gestureFrameReader.IsPaused = true; }
void Start() { Debug.Log ("got to bodysourcemanager"); GestureManager = this.GetComponent<CustomGestureManager> (); _Sensor = KinectSensor.GetDefault(); if (_Sensor != null) { _Reader = _Sensor.BodyFrameSource.OpenReader(); if (!_Sensor.IsOpen) { _Sensor.Open(); } } }