Exemplo n.º 1
0
        // Start is called before the first frame update
        new void Start()
        {
            base.Start();

            int s1 = (int)HandType.Max, s2 = fingertips.Length;

            Vector3[,] fingerPosition = new Vector3[s1, s2];
            Vector3[] gripPosition = new Vector3[s1];
            FingerShape[,] fingerShape = new FingerShape[s1, s2];
            HandShape[] handShape = new HandShape[s1];
            Vector3[]   handVelocity = new Vector3[s1];
            Vector3[]   handAcceleration = new Vector3[s1];

            for (int i = 0; i < s1; ++i)
            {
                for (int j = 0; j < s2; ++j)
                {
                    fingerPosition[i, j] = new Vector3();
                    fingerShape[i, j]    = FingerShape.Max;
                }
                gripPosition[i]     = new Vector3();
                handShape[i]        = HandShape.Unknown;
                handVelocity[i]     = new Vector3();
                handAcceleration[i] = new Vector3();
            }

            cachedPoseData = new CircularBuffer <PoseDataFrame>(Globals.FRAME_BUFFER_SIZE,
                                                                new PoseDataFrame(fingerPosition, gripPosition, fingerShape, handShape, handVelocity, handAcceleration));
            _avatarHands[0] = HandRight; _avatarHands[1] = HandLeft;
        }
Exemplo n.º 2
0
        private static void ComputeFingerShape(Vector3[,] userFingertipPosition, out FingerShape[,] userFingerShape)
        {
            userFingerShape = new FingerShape[(int)HandType.Max, fingertips.Length];

            for (int i = 0; i < (int)HandType.Max; ++i)
            {
                for (int j = 0; j < fingertips.Length; ++j)
                {
                    userFingerShape[i, j] = _GetFingerShapeFromPosition((HandType)i, fingertips[j], userFingertipPosition);
                }
            }
        }