Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        bool foundPose = false;

        foreach (var pose in Poses)
        {
            Handedness handedness = Handedness.None;
            if (ComparePose(Hands.HandRight, pose.LocalRotations))
            {
                handedness = Handedness.Right;
            }
            if (ComparePose(Hands.HandLeft, pose.LocalRotations))
            {
                handedness |= Handedness.Left;
            }

            if (handedness != Handedness.None)
            {
                currentPose            = pose;
                currentPose.Handedness = handedness;
                foundPose = true;
                break;
            }
        }
        if (!foundPose)
        {
            currentPose = empty;
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            SavePose(record);
        }
    }
Exemplo n.º 2
0
    void SavePose(Record record)
    {
        if (record == Record.Off)
        {
            return;
        }

        HandPoseV1 pose = new HandPoseV1();

        pose.Name           = DateTime.Now.ToString();
        pose.LocalRotations = new List <Quaternion>();
        for (int i = 0; i < Hands.HandRight.Count; i++)
        {
            if (record == Record.Right)
            {
                pose.LocalRotations.Add(Hands.HandRight[i].localRotation);
            }
            else
            {
                pose.LocalRotations.Add(Hands.HandLeft[i].localRotation);
            }
        }
        Poses.Add(pose);
    }