void Start() { _Sensor = Windows.Kinect.KinectSensor.GetDefault(); if (_Sensor != null) { _Reader = _Sensor.BodyFrameSource.OpenReader(); if (!_Sensor.IsOpen) { _Sensor.Open(); } isActive = true; // Floor _Reader.FrameArrived += (object sender, BodyFrameArrivedEventArgs e) => { using(var frame = e.FrameReference.AcquireFrame()) { this.currentTime = frame.RelativeTime; this.currentFloor = frame.FloorClipPlane; } }; } }
void Start() { if (null == this.BodySourceManager) { BodySourceManager[] objs = FindObjectsOfType(typeof(BodySourceManager)) as BodySourceManager[]; if (objs.Length > 0) { this.BodySourceManager = objs[0]; } } _Sensor = Windows.Kinect.KinectSensor.GetDefault(); cam = GameObject.Find("Main Camera").GetComponent <Camera>(); resFactorY = (float)Screen.height / 1080; resFactorX = (float)Screen.width / 1920; }
void OnApplicationQuit() { if (_Reader != null) { _Reader.Dispose(); _Reader = null; } if (_Sensor != null) { if (_Sensor.IsOpen) { _Sensor.Close(); } _Sensor = null; } }