用于 Kinect 1.0 的底部电机角度调整 适用Unity Kinect的SDK版本用的是1.8

mac2024-03-31  28

//用于 Kinect 1.0 的底部电机角度调整 适用Unity Kinect的SDK版本用的是1.8 //找了好半天才找到API 纪录下省着忘了 也给找半天的人提供一个入口

Kinect可视角度: 垂直方向:43度,水平方向57度;

马达倾斜范围: 仅能在垂直方向上调整: 上下28度;

[Header("底座马达角度")] public int Base_motor = 0; void Start () { //读取角度 LoadAngle(); } /// <summary> /// Kinect 底座马达角度 /// </summary> /// <param name="Base_motor"> 度 </param> void SetAngle(int Base_motor) { KinectWrapper.NuiCameraElevationSetAngle(Base_motor); int AnD = 0; KinectWrapper.NuiCameraElevationGetAngle(out AnD); print("Kinect角度:" + AnD); PlayerPrefs.SetInt("NuiCameraElevationSetAngle", Base_motor); } /// <summary> /// 读取角度 /// </summary> void LoadAngle() { int Angle = PlayerPrefs.GetInt("NuiCameraElevationSetAngle"); SetAngle(Angle); } void Update() { //底座马达 if (Input.GetKeyDown(KeyCode.W)) { Base_motor += 10; SetAngle(Base_motor); } if (Input.GetKeyDown(KeyCode.S)) { Base_motor -= 10; SetAngle(Base_motor); } }
最新回复(0)