手势)"/>
kinect笔记 三、识别手型(手部位置和手势)
在unity中获取手的位置
创建一个空物体,命名为KinectManager,给该物体绑定上KinectManager 和 InteractionManager脚本
其中InteractionManager脚本上有三个纹理,Grip Hand Texture 是握拳,Release Hand Texture是手摊开的状态,Normal Hand Texture理论上应该是手呈半握状态并且其中的个别手指摊开,但是我从没有触发过
再新建一个空物体,命名为InteractionListener,新建一个脚本MyInteractionListener,这个脚本需要跟摄像机和InteractionManager相关联,但是InteractionManager可以用kinect的属性获取,所以只需要将摄像机拖拽到脚本上关联即可
using System.Collections; using System.Collections.Generic; using UnityEngine;public class MyInteractionListener : MonoBehaviour ,InteractionListenerInterface{[Tooltip("Camera used for screen ray-casting. This is usually the main camera. 用于屏幕光线投射的照相机。这通常是主相机。")]public Camera screenCamera;//[Tooltip("Interaction manager instance, used to detect hand interactions. If left empty, it will be the first interaction manager found in the scene.")][Tooltip("交互管理器实例,用于检测手交互。如果为空,它将是场景中发现的第一个交互管理器")]public InteractionManager interactionManager;// hand interaction variables 手的交互变量private InteractionManager.HandEventType lastHandEvent = InteractionManager.HandEventType.None;// normalized and pixel position of the cursor 鼠标光标的统一化和位置private Vector3 screenNormalPos = Vector3.zero;private Vector3 screenPixelPos = Vector3.zero;private Vector3 newObjectPos = Vector3.zero;/*[Tooltip("Minimum Z-position of the dragged object, when moving forward and back.")]public float minZ = 0f;[Tooltip("Maximum Z-position of the dragged object, when moving forward and back.")]public float maxZ = 5f;*//// <summary><
更多推荐
kinect笔记 三、识别手型(手部位置和手势)
发布评论