Exemple #1
0
        public void Update()
        {
            // Do not update if huaweiAR is not tracking.
            if (ARFrame.GetTrackingState() != ARTrackable.TrackingState.TRACKING)
            {
                m_mesh.Clear();
                return;
            }

            // Fill in the data to draw the point cloud.
            ARPointCloud pointCloud = ARFrame.AcquirePointCloud();

            pointCloud.GetPoints(ref m_points);
            pointCloud.Release();
            if (m_points.Count > 0)
            {
                // Update the mesh indicies array.
                m_pointIndex.Clear();
                for (int i = 0; i < Mathf.Min(m_points.Count, k_maxPointCount); i++)
                {
                    m_pointIndex.Add(i);
                }

                m_mesh.Clear();
                m_mesh.vertices = m_points.ToArray();
                m_mesh.SetIndices(m_pointIndex.ToArray(), MeshTopology.Points, 0);
            }
        }