直接上代码,首先需要定义一个bool变量来判断设备是否准备好,在定义一个RawImage来显示人物的彩色和深度数据

public bool isAngetKinect;

public RawImage UserTexture;

void Update()

{

//判断设备是否准备好

isAngetKinect = KinectManager.Instance.IsInitialized();

if (isAgent )
        {
            if (UserTexture.texture == null)
            {
                //获取彩色数据
                 Texture2D texture = KinectManager.Instance.GetUsersClrTex();
                //获取深度数据
               // Texture2D texture = KinectManager.Instance.GetUsersLblTex();
                UserTexture.texture = texture;

            }

 //判断是否检测到玩家
            if (KinectManager.Instance.IsUserDetected())
            {
                //获取玩家的ID
                long userId = KinectManager.Instance.GetPrimaryUserID();
                //获取右手
                int jointType = (int) KinectInterop.JointType.HandRight;
                //获取左手
                int LeftType = (int) KinectInterop.JointType.HandLeft;

//KinectInterop.JointType 可以获取人物身上的任意骨骼点需要什么直接获取就行

//追踪到关节点
                if (KinectManager.Instance.IsJointTracked(userId,jointType))
                {
                    //获取右手位置
                    Vector3 rightHandpos = KinectManager.Instance.GetJointKinectPosition(userId, jointType);

}

//kinect人物的骨骼点

Unity Kinect开发 获取人物数据

如果是才接触这个kinect开发的话可以去看看这个视频我感觉讲的挺细的

http://www.maiziedu.com/course/525-7199/

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-06-01
  • 2021-09-15
  • 2021-10-22
猜你喜欢
  • 2022-12-23
  • 2021-12-26
  • 2021-10-05
  • 2022-01-15
  • 2022-12-23
  • 2021-10-01
  • 2021-09-20
相关资源
相似解决方案