Exemplo n.º 1
0
    private void Update()
    {
        // Only update if session is tracking
        if (Session.Status != SessionStatus.Tracking)
        {
            return;
        }

        Session.GetTrackables(newDetectedPlanes, TrackableQueryFilter.New);
        foreach (DetectedPlane newPlane in newDetectedPlanes)
        {
            DetectedPlaneVisualizer planeVisualizer = Instantiate(detectedPlanePrefab, Vector3.zero, Quaternion.identity, transform);
            planeVisualizer.Initialize(newPlane);
            detectedPlanes.Add(planeVisualizer.gameObject);
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        if (Session.Status != SessionStatus.Tracking)
        {
            return;
        }

        Session.GetTrackables <DetectedPlane>(_newPlanes, TrackableQueryFilter.New);
        for (int i = 0; i < _newPlanes.Count; i++)
        {
            GameObject planeObject             = Instantiate(PlanePrefab, Vector3.zero, Quaternion.identity, transform);
            DetectedPlaneVisualizer visualizer = planeObject.GetComponent <DetectedPlaneVisualizer>();
            if (visualizer != null)
            {
                visualizer.Initialize(_newPlanes[i]);
                _allPlanes.Add(visualizer);
                visualizer.MeshRenderer.enabled = ShouldShowVisualizer;
            }
        }
    }