// Update is called once per frame void Update() { // For testing only. //handRenderer.queryLeftHand2DCoordinates (); _outputData = SenseToolkitManager.Instance.HandDataOutput; if (_outputData != null) { _outputData.Update(); /* Retrieve Hand Joints*/ joints = new PXCMHandData.JointData[2, PXCMHandData.NUMBER_OF_JOINTS]; for (int i = 0; i < _outputData.QueryNumberOfHands(); i++) { PXCMHandData.IHand _handData; _outputData.QueryHandData(PXCMHandData.AccessOrderType.ACCESS_ORDER_FIXED, i, out _handData); //Debug.Log(_handData.IsCalibrated().ToString()); //if(_handData!=null){ //else { Debug.Log ("No data"); continue; } for (int j = 0; j < PXCMHandData.NUMBER_OF_JOINTS; j++) { _handData.QueryTrackedJoint((PXCMHandData.JointType)j, out joints[i, j]); } handIds[i] = _handData.QueryUniqueId(); bodySides[i] = _handData.QueryBodySide(); if (!_handData.IsCalibrated()) { if (bodySides[i] == PXCMHandData.BodySideType.BODY_SIDE_LEFT) { isleftCalibrated = false; } else if (bodySides[i] == PXCMHandData.BodySideType.BODY_SIDE_RIGHT) { isrightCalibrated = false; } } else { if (bodySides[i] == PXCMHandData.BodySideType.BODY_SIDE_LEFT) { isleftCalibrated = true; } else if (bodySides[i] == PXCMHandData.BodySideType.BODY_SIDE_RIGHT) { isrightCalibrated = true; } } } handRenderer.DisplaySmoothenedJoints(_outputData, joints, handIds, bodySides, _outputData.QueryNumberOfHands()); /* Retrieve Alert Data */ /* * PXCMHandData.AlertData _alertData; * for (int i = 0; i < _outputData.QueryFiredAlertsNumber(); i++) * if (_outputData.QueryFiredAlertData(i, out _alertData) == pxcmStatus.PXCM_STATUS_NO_ERROR) * handRenderer.DisplayAlerts(_alertData); */ /* Retrieve Gesture Data */ PXCMHandData.GestureData _gestureData; for (int i = 0; i < _outputData.QueryFiredGesturesNumber(); i++) { if (_outputData.QueryFiredGestureData(i, out _gestureData) == pxcmStatus.PXCM_STATUS_NO_ERROR) { handRenderer.DisplayGestures(_gestureData); } } if (_outputData.QueryNumberOfHands() == 0) { handRenderer.makeNull(); } } else { handRenderer.makeNull(); } // For testing //handRenderer.DisplayGest (); displayHandGestures(); }