Exemple #1
0
    /// <summary>
    /// Update this instance. Called at each frame
    /// </summary>
    void Update()
    {
        UpdateImages();
        updateHmdPose();
        UpdateTracking();

        //If the ZED is disconnected, to easily look at the message
        if (isDisconnected)
        {
            if (OnZEDDisconnected != null)
            {
                OnZEDDisconnected();
            }

            ZEDDisconnected();
        }

#if UNITY_EDITOR
        if (zedCamera != null)
        {
            float frame_drop_count = zedCamera.GetFrameDroppedPercent();
            float CurrentTickFPS   = 1.0f / Time.deltaTime;
            fps_engine = (fps_engine + CurrentTickFPS) / 2.0f;
            engineFPS  = fps_engine.ToString("F1") + " FPS";
            if (frame_drop_count > 30 && fps_engine < 45)
            {
                engineFPS += "WARNING : engine low framerate detected";
            }
            trackingState = ZEDTrackingState.ToString();
        }
#endif
    }
Exemple #2
0
    /// <summary>
    /// Update this instance. Called at each frame
    /// </summary>
    void Update()
    {
        // Update Image first, then collect HMD pose at the image time.
        // Then update the tracking
        UpdateImages();
        updateHmdPose();
        UpdateTracking();

        //If the ZED is disconnected, to easily look at the message
        if (isDisconnected)
        {
            if (OnZEDDisconnected != null)
            {
                OnZEDDisconnected();
            }

            ZEDDisconnected();
        }

                #if UNITY_EDITOR
        if (zedCamera != null)
        {
            float frame_drop_count = zedCamera.GetFrameDroppedPercent();
            float CurrentTickFPS   = 1.0f / Time.deltaTime;
            fps_engine = (fps_engine + CurrentTickFPS) / 2.0f;
            engineFPS  = fps_engine.ToString("F1") + " FPS";
            if (frame_drop_count > 30 && fps_engine < 45)
            {
                engineFPS += "WARNING : engine low framerate detected";
            }

            if (isZEDTracked)
            {
                trackingState = ZEDTrackingState.ToString();
            }
            else if (VRDevice.isPresent && isStereoRig)
            {
                trackingState = "HMD Tracking";
            }
            else
            {
                trackingState = "Camera Not Tracked";
            }
        }
                #endif
    }