void Update() { _KinectSensor = _AzureKinectManager.SensorList[_DeviceNumber]; if (_KinectSensor != null) { if (_KinectSensor.RawColorImage != null) { _ColorImageTexture.LoadRawTextureData(_KinectSensor.RawColorImage); _ColorImageTexture.Apply(); } if (_KinectSensor.PointCloud != null) { Short3[] pointCloud = _KinectSensor.PointCloud; Vector3[] vertices = new Vector3[pointCloud.Length]; for (int i = 0; i < vertices.Length; i++) { vertices[i] = new Vector3(pointCloud[i].X * 0.001f, pointCloud[i].Y * -0.001f, pointCloud[i].Z * 0.001f); } _PointCloudMesh.UpdateVertices(vertices); _PointCloudMesh.UpdateColorTexture(_KinectSensor.RawColorImage); } } }
void Update() { _KinectSensor = _AzureKinectManager.SensorList[_DeviceNumber]; if (_KinectSensor != null) { if (_KinectSensor.RawColorImage != null) { _ColorImageTexture.LoadRawTextureData(_KinectSensor.RawColorImage); _ColorImageTexture.Apply(); } if (_KinectSensor.PointCloud != null) { Short3[] pointCloud = _KinectSensor.PointCloud; Vector3[] vertices = new Vector3[pointCloud.Length]; for (int i = 0; i < vertices.Length; i++) { vertices[i] = new Vector3(pointCloud[i].X * 0.001f, pointCloud[i].Y * -0.001f, pointCloud[i].Z * 0.001f); } _PointCloudMesh.UpdateVertices(vertices); _PointCloudMesh.UpdateColorTexture(_KinectSensor.RawColorImage); } System.Numerics.Vector3 accel = _KinectSensor.ImuSample.AccelerometerSample; if (LowPassFilter) { _Accel[0] = accel.X; _Accel[1] = accel.Y; _Accel[2] = accel.Z; _LowPassFilter.Apply(_Accel, ref _AccelOut); accel.X = _AccelOut[0]; accel.Y = _AccelOut[1]; accel.Z = _AccelOut[2]; } UnityEngine.Vector3 kinectOrientation = OrientationEstimator.EstimateFromAccelerometerForUnity(accel); this.transform.eulerAngles = kinectOrientation; } }