Exemplo n.º 1
0
        private void Update()
        {
            // Grab the necessary mesh data from the current set of surfaces that we want to run
            // PlaneFinding against.  This must be done on the main UI thread.
            meshData.Clear();
            foreach (MeshFilter mesh in GetComponentsInChildren <MeshFilter>())
            {
                meshData.Add(new PlaneFinding.MeshData(mesh));
            }

            // Now call FindPlanes().  NOTE: In a real application, this MUST be executed on a
            // background thread (i.e.: via ThreadPool.QueueUserWorkItem) so that it doesn't stall the
            // rendering thread while running plane finding.  Maintaining a solid 60fps is crucial
            // to a good user experience.
            planes = (VisualizeSubPlanes) ?
                     PlaneFinding.FindSubPlanes(meshData, SnapToGravityThreshold) :
                     PlaneFinding.FindPlanes(meshData, SnapToGravityThreshold, MinArea);
        }
Exemplo n.º 2
0
        private void FindSubPlanes()
        {
            Vector3    hlWorldPosition = MixedRealityCamera.transform.position;
            Quaternion hlWorldRotation = MixedRealityCamera.transform.rotation;

            // Should not run plane finding on main Unity thread
            var planeFindingProcess = Task.Run(() => {
                m_mergedBoundingPlanes = PlaneFinding.FindSubPlanes(m_collectedMeshData, snapToGravityThreshold).ToList();

                if (m_mergedBoundingPlanes.Count > 0)
                {
                    m_PlaneFindingSuccess.Set();
                }
                else
                {
                    m_PlaneFindingFailed.Set();
                    return;
                }

                // Update Dictionary
                ParseRawPlaneData(hlWorldPosition);
            });
        }