Exemple #1
0
    /// <summary>
    /// Function, sets the viewpoint of the camera to the middle on the boundig box, that is placed
    /// on the scene. Calls the method for taking the screenshots, when possible.
    /// </summary>
    /// <returns>IEnumerator</returns>
    public IEnumerator TakeScreenShotToFocusPoint()
    {
        // Determine focuspoint
        Vector3 focusPoint = BoundingBox.GetComponent <BoxCollider>().bounds.center;;

        // Draw only points for visualisation
        if (drawPoints)
        {
            if (IsPositionUsed(focusPoint))
            {
                Instantiate(ViewPoint, focusPoint, Quaternion.identity);
            }
            Instantiate(CamPosPoint, transform.position, Quaternion.identity);
            yield return(null);
        }
        else if (ScreenshotHandler.IsToCloseToViewpoint(transform.position, focusPoint) || ScreenshotHandler.IsInsideBuilding(transform.position))
        {
            yield return(null);
        }
        else
        {
            _index++;
            transform.LookAt(focusPoint);
            yield return(StartCoroutine(ScreenshotHandler.TakeScreenshots(_index)));
        }
    }