void OnPointCloudChanged(ARPointCloudUpdatedEventArgs eventArgs)
        {
            if (Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Stationary)
            {
                var points = s_Vertices;
                points.Clear();
                foreach (var point in m_PointCloud.positions)
                {
                    s_Vertices.Add(point);
                }

                int numParticles = points.Count;
                //if (m_Particles == null || m_Particles.Length < numParticles)
                //    m_Particles = new ParticleSystem.Particle[numParticles];

                var temp = m_Particles;
                m_Particles = new ParticleSystem.Particle[numParticles + (temp == null ? 0 : temp.Length)];

                var color = m_ParticleSystem.main.startColor.color;
                var size  = m_ParticleSystem.main.startSize.constant;

                for (int i = 0; i < numParticles; ++i)
                {
                    m_Particles[i].startColor        = color;
                    m_Particles[i].startSize         = size;
                    m_Particles[i].position          = points[i];
                    m_Particles[i].remainingLifetime = 1000f;
                }

                if (temp != null)
                {
                    for (int i = numParticles; i < temp.Length + numParticles; ++i)
                    {
                        m_Particles[i].startColor        = color;
                        m_Particles[i].startSize         = size;
                        m_Particles[i].position          = temp[i - numParticles].position;
                        m_Particles[i].remainingLifetime = 1000f;
                    }
                }

                // Remove any existing particles by setting remainingLifetime
                // to a negative value.
                for (int i = numParticles; i < m_NumParticles; ++i)
                {
                    // m_Particles[i].remainingLifetime = -1f;
                }


                m_ParticleSystem.SetParticles(m_Particles, m_Particles.Length);
                m_NumParticles = m_Particles.Length;
            }
        }
        private void OnPointCloudChanged(ARPointCloudUpdatedEventArgs eventArgs)
        {
            if (!lastFrame)
            {
                GetCurrentPoints();
            }

            else
            {
                Debug.Log("unsub from pc update");
                arPointCloud.updated -= OnPointCloudChanged;
                GetCurrentPoints();
            }
        }
Пример #3
0
 private void OnPointCloudUpdated(ARPointCloudUpdatedEventArgs args)
 {
     args.pointCloud.GetPoints(activePoints);
 }
Пример #4
0
 private void OnPointCloudUpdated(ARPointCloudUpdatedEventArgs obj)
 {
     m_pointSatisfaction.Value = Mathf.Max(0, m_pointSatisfaction.Value - 1);
 }
Пример #5
0
 //To get the number of points when point cloud updated
 void PointCloudCountFunction(ARPointCloudUpdatedEventArgs pointCloud_Args)
 {
     pointCloud_Args.pointCloud.GetPoints(pointList);
     nPoints = pointList.Count;
     displayCountText();
 }
Пример #6
0
 void OnPointCloudChanged(ARPointCloudUpdatedEventArgs eventArgs)
 {
     ARRecord.instance.PointCloudChanged();
 }