コード例 #1
0
 void Update()
 {
     nt.setRGB();
     nt.setSkeleton();
     nt.setFace();
     nt.imshowBlack();
     Debug.Log("n = " + nt.skeleton.Count);
 }
コード例 #2
0
ファイル: Sample02.cs プロジェクト: allenpaulchen/VTPRO
    void Update()
    {
        nt.setRGB();
        nt.setSkeleton();
        nt.setFace();
        // nt.imshowBlack();
        int n = nt.getSkeleton();

        //humanoid.transform.Rotate(0, hs.joint[NtUnity.Kinect.JointType_ShoulderLeft].z - hs.joint[NtUnity.Kinect.JointType_ShoulderRight].z, 0, Space.Self);
        if (n > 0)
        {
            humanoid.SetActive(true);
            hs.set(nt, 0, correction, mirror, move);
            //humanoid.transform.rotation = Quaternion.Euler(0, PointRotation(hs.joint[NtUnity.Kinect.JointType_HipRight], hs.joint[NtUnity.Kinect.JointType_HipLeft]), 0);
            camera.transform.position = new Vector3(0, hs.joint[NtUnity.Kinect.JointType_Head].y, 0);
        }
        else
        {
            humanoid.SetActive(false);
        }

        if (hs.joint[NtUnity.Kinect.JointType_ElbowLeft].y > hs.joint[NtUnity.Kinect.JointType_Head].y &&
            hs.joint[NtUnity.Kinect.JointType_ElbowRight].y > hs.joint[NtUnity.Kinect.JointType_Head].y)
        {
            Thread.Sleep(500);//想一下要怎麼辦比較好
            clothes_number++;

            switch (clothes_number)
            {
            case 1:
                humanoid_material = Resources.Load("Material/sample/circus1", typeof(Material)) as Material;
                break;

            case 2:
                humanoid_material = Resources.Load("Material/sample/circus2", typeof(Material)) as Material;
                break;

            case 3:
                humanoid_material = Resources.Load("Material/sample/underocean", typeof(Material)) as Material;
                break;

            //insert new here
            default:
                clothes_number    = 0;
                humanoid_material = Resources.Load("Material/sample/mine", typeof(Material)) as Material;
                break;
            }
            mesh.GetComponent <Renderer>().material = humanoid_material;
        }
    }
コード例 #3
0
    void Update()
    {
        nt.setRGB();
        nt.setSkeleton();
        //nt.setFace();
        nt.imshowBlack();
        int n = nt.getSkeleton();

        if (n > 0)
        {
            cs.set(nt, 0, mirror, move, headMove);
            rhState = nt.handState(false);
            lhState = nt.handState(true);
        }

        Debug.Log("rh:" + rhState + "lh:" + lhState);
    }